git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH 0/2] Pedantic fixes for Apple clang
@ 2018-07-24 21:52 Beat Bolli
  2018-07-24 21:52 ` [PATCH 1/2] packfile: drop a repeated enum declaration Beat Bolli
  2018-07-24 21:52 ` [PATCH 2/2] remote-odb: un-inline function remote_odb_reinit Beat Bolli
  0 siblings, 2 replies; 8+ messages in thread
From: Beat Bolli @ 2018-07-24 21:52 UTC (permalink / raw)
  To: git; +Cc: gitster, Beat Bolli

Following up on my previous series bb/pedantic for gcc, here are two
fixes for pedantic compilation under MacOS 10.13.6 (High Sierra) with
the command line tools of Xcode Version 9.4.1 (9F2000).

Beat Bolli (2):
  packfile: drop a repeated enum declaration
  remote-odb: un-inline function remote_odb_reinit

 packfile.h   | 1 -
 remote-odb.c | 2 +-
 2 files changed, 1 insertion(+), 2 deletions(-)

-- 
2.18.0


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/2] packfile: drop a repeated enum declaration
  2018-07-24 21:52 [PATCH 0/2] Pedantic fixes for Apple clang Beat Bolli
@ 2018-07-24 21:52 ` Beat Bolli
  2018-07-24 21:57   ` Jonathan Nieder
  2018-07-24 21:52 ` [PATCH 2/2] remote-odb: un-inline function remote_odb_reinit Beat Bolli
  1 sibling, 1 reply; 8+ messages in thread
From: Beat Bolli @ 2018-07-24 21:52 UTC (permalink / raw)
  To: git; +Cc: gitster, Beat Bolli

When compiling under Apple LLVM version 9.1.0 (clang-902.0.39.2) with
"make DEVELOPER=1 DEVOPTS=pedantic", the compiler says

    error: redeclaration of already-defined enum 'object_type' is a GNU
    extension [-Werror,-Wgnu-redeclared-enum]

According to https://en.cppreference.com/w/c/language/declarations
(section "Redeclaration"), a repeated declaration after the definition
is only legal for structs and unions, but not for enums.

Drop the belated declaration of enum object_type. It seems that each
includer of packfile.h includes the definition of the enum before
including packfile.h.

Signed-off-by: Beat Bolli <dev+git@drbeat.li>
---
 packfile.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/packfile.h b/packfile.h
index 51383774ec72..9b6198c4c7e0 100644
--- a/packfile.h
+++ b/packfile.h
@@ -6,7 +6,6 @@
 /* in object-store.h */
 struct packed_git;
 struct object_info;
-enum object_type;
 
 /*
  * Generate the filename to be used for a pack file with checksum "sha1" and
-- 
2.18.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/2] remote-odb: un-inline function remote_odb_reinit
  2018-07-24 21:52 [PATCH 0/2] Pedantic fixes for Apple clang Beat Bolli
  2018-07-24 21:52 ` [PATCH 1/2] packfile: drop a repeated enum declaration Beat Bolli
@ 2018-07-24 21:52 ` Beat Bolli
  2018-07-24 21:59   ` Jonathan Nieder
  1 sibling, 1 reply; 8+ messages in thread
From: Beat Bolli @ 2018-07-24 21:52 UTC (permalink / raw)
  To: git; +Cc: gitster, Beat Bolli

When compiling under Apple LLVM version 9.1.0 (clang-902.0.39.2) with
"make DEVELOPER=1 DEVOPTS=pedantic", the compiler says

    remote-odb.c:87:2: error: static function 'remote_odb_do_init' is
    used in an inline function with external linkage
    [-Werror,-Wstatic-in-inline]

Remove the inline specifier that would only make sense if
remote_odb_reinit were defined in the header file. Moving it into the
header is not possible because the called function remote_odb_do_init is
static and thus not visible from the includers of the header.

Signed-off-by: Beat Bolli <dev+git@drbeat.li>
---
 remote-odb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/remote-odb.c b/remote-odb.c
index 847a86505778..49cf8e30aa92 100644
--- a/remote-odb.c
+++ b/remote-odb.c
@@ -82,7 +82,7 @@ static inline void remote_odb_init(void)
 	remote_odb_do_init(0);
 }
 
-inline void remote_odb_reinit(void)
+void remote_odb_reinit(void)
 {
 	remote_odb_do_init(1);
 }
-- 
2.18.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/2] packfile: drop a repeated enum declaration
  2018-07-24 21:52 ` [PATCH 1/2] packfile: drop a repeated enum declaration Beat Bolli
@ 2018-07-24 21:57   ` Jonathan Nieder
  0 siblings, 0 replies; 8+ messages in thread
From: Jonathan Nieder @ 2018-07-24 21:57 UTC (permalink / raw)
  To: Beat Bolli; +Cc: git, gitster

Hi,

Beat Bolli wrote:

> --- a/packfile.h
> +++ b/packfile.h
> @@ -6,7 +6,6 @@
>  /* in object-store.h */
>  struct packed_git;
>  struct object_info;
> -enum object_type;
>  
>  /*
>   * Generate the filename to be used for a pack file with checksum "sha1" and

Good catch.  This means packfile.h should #include "cache.h" ---
otherwise, it is not usable in a file that does

	#include "git-compat-util.h"
	#include "packfile.h"

Thanks and hope that helps,
Jonathan

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 2/2] remote-odb: un-inline function remote_odb_reinit
  2018-07-24 21:52 ` [PATCH 2/2] remote-odb: un-inline function remote_odb_reinit Beat Bolli
@ 2018-07-24 21:59   ` Jonathan Nieder
  2018-07-24 22:03     ` Beat Bolli
  0 siblings, 1 reply; 8+ messages in thread
From: Jonathan Nieder @ 2018-07-24 21:59 UTC (permalink / raw)
  To: Beat Bolli; +Cc: git, gitster, Christian Couder

Hi,

Beat Bolli wrote:

> When compiling under Apple LLVM version 9.1.0 (clang-902.0.39.2) with
> "make DEVELOPER=1 DEVOPTS=pedantic", the compiler says
>
>     remote-odb.c:87:2: error: static function 'remote_odb_do_init' is
>     used in an inline function with external linkage
>     [-Werror,-Wstatic-in-inline]
>
> Remove the inline specifier that would only make sense if
> remote_odb_reinit were defined in the header file. Moving it into the
> header is not possible because the called function remote_odb_do_init is
> static and thus not visible from the includers of the header.
>
> Signed-off-by: Beat Bolli <dev+git@drbeat.li>
> ---
>  remote-odb.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

What branch does this apply to?

[...]
> --- a/remote-odb.c
> +++ b/remote-odb.c
> @@ -82,7 +82,7 @@ static inline void remote_odb_init(void)
>  	remote_odb_do_init(0);
>  }
>  
> -inline void remote_odb_reinit(void)
> +void remote_odb_reinit(void)

This looks like an oversight in
https://public-inbox.org/git/20180713174959.16748-6-chriscool@tuxfamily.org/:
there isn't any reason for this function to be inline.

Christian, can you squash it in on your next reroll?

Thanks,
Jonathan

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 2/2] remote-odb: un-inline function remote_odb_reinit
  2018-07-24 21:59   ` Jonathan Nieder
@ 2018-07-24 22:03     ` Beat Bolli
  2018-07-25  7:29       ` Christian Couder
  0 siblings, 1 reply; 8+ messages in thread
From: Beat Bolli @ 2018-07-24 22:03 UTC (permalink / raw)
  To: Jonathan Nieder; +Cc: git, gitster, Christian Couder

Hi Jonathan

On 24.07.18 23:59, Jonathan Nieder wrote:
> Hi,
> 
> Beat Bolli wrote:
> 
>> When compiling under Apple LLVM version 9.1.0 (clang-902.0.39.2) with
>> "make DEVELOPER=1 DEVOPTS=pedantic", the compiler says
>>
>>     remote-odb.c:87:2: error: static function 'remote_odb_do_init' is
>>     used in an inline function with external linkage
>>     [-Werror,-Wstatic-in-inline]
>>
>> Remove the inline specifier that would only make sense if
>> remote_odb_reinit were defined in the header file. Moving it into the
>> header is not possible because the called function remote_odb_do_init is
>> static and thus not visible from the includers of the header.
>>
>> Signed-off-by: Beat Bolli <dev+git@drbeat.li>
>> ---
>>  remote-odb.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> What branch does this apply to?

To pu as of today.

> [...]
>> --- a/remote-odb.c
>> +++ b/remote-odb.c
>> @@ -82,7 +82,7 @@ static inline void remote_odb_init(void)
>>  	remote_odb_do_init(0);
>>  }
>>  
>> -inline void remote_odb_reinit(void)
>> +void remote_odb_reinit(void)
> 
> This looks like an oversight in
> https://public-inbox.org/git/20180713174959.16748-6-chriscool@tuxfamily.org/:
> there isn't any reason for this function to be inline.
> 
> Christian, can you squash it in on your next reroll?

That would probably make sense. I didn't check how mature the topics
were that caused errors.

Beat

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 2/2] remote-odb: un-inline function remote_odb_reinit
  2018-07-24 22:03     ` Beat Bolli
@ 2018-07-25  7:29       ` Christian Couder
  2018-07-25 21:16         ` Junio C Hamano
  0 siblings, 1 reply; 8+ messages in thread
From: Christian Couder @ 2018-07-25  7:29 UTC (permalink / raw)
  To: Beat Bolli; +Cc: Jonathan Nieder, git, Junio C Hamano

Hi,

On Wed, Jul 25, 2018 at 12:03 AM, Beat Bolli <dev+git@drbeat.li> wrote:
>
> On 24.07.18 23:59, Jonathan Nieder wrote:
>>
>> Beat Bolli wrote:

>>> -inline void remote_odb_reinit(void)
>>> +void remote_odb_reinit(void)
>>
>> This looks like an oversight in
>> https://public-inbox.org/git/20180713174959.16748-6-chriscool@tuxfamily.org/:
>> there isn't any reason for this function to be inline.
>>
>> Christian, can you squash it in on your next reroll?
>
> That would probably make sense. I didn't check how mature the topics
> were that caused errors.

Ok, it is in the next version I will send.

Thanks,
Christian.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 2/2] remote-odb: un-inline function remote_odb_reinit
  2018-07-25  7:29       ` Christian Couder
@ 2018-07-25 21:16         ` Junio C Hamano
  0 siblings, 0 replies; 8+ messages in thread
From: Junio C Hamano @ 2018-07-25 21:16 UTC (permalink / raw)
  To: Christian Couder; +Cc: Beat Bolli, Jonathan Nieder, git

Christian Couder <christian.couder@gmail.com> writes:

> Hi,
>
> On Wed, Jul 25, 2018 at 12:03 AM, Beat Bolli <dev+git@drbeat.li> wrote:
>>
>> On 24.07.18 23:59, Jonathan Nieder wrote:
>>>
>>> Beat Bolli wrote:
>
>>>> -inline void remote_odb_reinit(void)
>>>> +void remote_odb_reinit(void)
>>>
>>> This looks like an oversight in
>>> https://public-inbox.org/git/20180713174959.16748-6-chriscool@tuxfamily.org/:
>>> there isn't any reason for this function to be inline.
>>>
>>> Christian, can you squash it in on your next reroll?
>>
>> That would probably make sense. I didn't check how mature the topics
>> were that caused errors.
>
> Ok, it is in the next version I will send.

OK, then I'll ignore this one for now.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2018-07-25 21:17 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-24 21:52 [PATCH 0/2] Pedantic fixes for Apple clang Beat Bolli
2018-07-24 21:52 ` [PATCH 1/2] packfile: drop a repeated enum declaration Beat Bolli
2018-07-24 21:57   ` Jonathan Nieder
2018-07-24 21:52 ` [PATCH 2/2] remote-odb: un-inline function remote_odb_reinit Beat Bolli
2018-07-24 21:59   ` Jonathan Nieder
2018-07-24 22:03     ` Beat Bolli
2018-07-25  7:29       ` Christian Couder
2018-07-25 21:16         ` Junio C Hamano

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).