mailing list of musl libc
 help / color / mirror / code / Atom feed
* superfluous space char in marco
@ 2017-04-16  7:58 Syrone Wong
  2017-04-17 14:48 ` Rich Felker
  0 siblings, 1 reply; 6+ messages in thread
From: Syrone Wong @ 2017-04-16  7:58 UTC (permalink / raw)
  To: musl

For include/net/if.h, we define it as

#define IFF_VOLATILE (IFF_LOOPBACK|IFF_POINTOPOINT|IFF_BROADCAST| \
        IFF_ECHO|IFF_MASTER|IFF_SLAVE|IFF_RUNNING|IFF_LOWER_UP|IFF_DORMANT)

while iproute2 4.10.0 define it as

#define IFF_VOLATILE (IFF_LOOPBACK|IFF_POINTOPOINT|IFF_BROADCAST|IFF_ECHO|\
IFF_MASTER|IFF_SLAVE|IFF_RUNNING|IFF_LOWER_UP|IFF_DORMANT)

in include/linux/if.h. The only difference is the space char after
IFF_BROADCAST.

This causes the redefinition of IFF_VOLATILE.

Warning when compiling iproute2 4.10.0:

In file included from ../include/linux/if_tunnel.h:5:0,
                 from iptunnel.c:24:
../include/linux/if.h:130:0: warning: "IFF_VOLATILE" redefined
 #define IFF_VOLATILE (IFF_LOOPBACK|IFF_POINTOPOINT|IFF_BROADCAST|IFF_ECHO|\

In file included from iptunnel.c:21:0:
/home/wong/github/lede-1/staging_dir/toolchain-arm_cortex-a9+vfpv3_gcc-6.3.0_musl_eabi/include/net/if.h:48:0:
note: this is the location of the previous definition
 #define IFF_VOLATILE (IFF_LOOPBACK|IFF_POINTOPOINT|IFF_BROADCAST| \


Best Regards,
Syrone Wong


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

* Re: superfluous space char in marco
  2017-04-16  7:58 superfluous space char in marco Syrone Wong
@ 2017-04-17 14:48 ` Rich Felker
  2017-04-17 15:28   ` Alexander Monakov
  0 siblings, 1 reply; 6+ messages in thread
From: Rich Felker @ 2017-04-17 14:48 UTC (permalink / raw)
  To: Syrone Wong; +Cc: musl

On Sun, Apr 16, 2017 at 03:58:11PM +0800, Syrone Wong wrote:
> For include/net/if.h, we define it as
> 
> #define IFF_VOLATILE (IFF_LOOPBACK|IFF_POINTOPOINT|IFF_BROADCAST| \
>         IFF_ECHO|IFF_MASTER|IFF_SLAVE|IFF_RUNNING|IFF_LOWER_UP|IFF_DORMANT)
> 
> while iproute2 4.10.0 define it as
> 
> #define IFF_VOLATILE (IFF_LOOPBACK|IFF_POINTOPOINT|IFF_BROADCAST|IFF_ECHO|\
> IFF_MASTER|IFF_SLAVE|IFF_RUNNING|IFF_LOWER_UP|IFF_DORMANT)
> 
> in include/linux/if.h. The only difference is the space char after
> IFF_BROADCAST.

Do the other iproute2 include/linux/* headers actually work now? My
experience building it in the past has been that you have to rm -rf
that directory to get it to build at all since it contained outdated
and clashing versions of those headers. Maybe something has changed in
recent versions.

> This causes the redefinition of IFF_VOLATILE.
> 
> Warning when compiling iproute2 4.10.0:
> 
> In file included from ../include/linux/if_tunnel.h:5:0,
>                  from iptunnel.c:24:
> .../include/linux/if.h:130:0: warning: "IFF_VOLATILE" redefined
>  #define IFF_VOLATILE (IFF_LOOPBACK|IFF_POINTOPOINT|IFF_BROADCAST|IFF_ECHO|\
> 
> In file included from iptunnel.c:21:0:
> /home/wong/github/lede-1/staging_dir/toolchain-arm_cortex-a9+vfpv3_gcc-6.3.0_musl_eabi/include/net/if.h:48:0:
> note: this is the location of the previous definition
>  #define IFF_VOLATILE (IFF_LOOPBACK|IFF_POINTOPOINT|IFF_BROADCAST| \

This is odd and looks like a gcc bug. Preprocessor macros definitions
are sequences of PP tokens, not literal code strings, meaning that
whitespace is irrelevant as long as the resulting sequence of PP
tokens remains the same; it's a matching definition not a
redefinition.

Anyone else have thoughts on what's going on?

Rich


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

* Re: superfluous space char in marco
  2017-04-17 14:48 ` Rich Felker
@ 2017-04-17 15:28   ` Alexander Monakov
  2017-04-17 17:02     ` Rich Felker
  0 siblings, 1 reply; 6+ messages in thread
From: Alexander Monakov @ 2017-04-17 15:28 UTC (permalink / raw)
  To: musl

On Mon, 17 Apr 2017, Rich Felker wrote:
> This is odd and looks like a gcc bug. Preprocessor macros definitions
> are sequences of PP tokens, not literal code strings, meaning that
> whitespace is irrelevant as long as the resulting sequence of PP
> tokens remains the same; it's a matching definition not a
> redefinition.

No, according to C11 6.10.3 p1 presence of whitespace is significant (its
contents are not), and 6.10.3.5 example 6 corroborates that.  GCC, Clang,
ICC and MSVC on Godbolt all agree with that.

Alexander


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

* Re: superfluous space char in marco
  2017-04-17 15:28   ` Alexander Monakov
@ 2017-04-17 17:02     ` Rich Felker
  2017-04-17 17:29       ` Szabolcs Nagy
  0 siblings, 1 reply; 6+ messages in thread
From: Rich Felker @ 2017-04-17 17:02 UTC (permalink / raw)
  To: musl

On Mon, Apr 17, 2017 at 06:28:58PM +0300, Alexander Monakov wrote:
> On Mon, 17 Apr 2017, Rich Felker wrote:
> > This is odd and looks like a gcc bug. Preprocessor macros definitions
> > are sequences of PP tokens, not literal code strings, meaning that
> > whitespace is irrelevant as long as the resulting sequence of PP
> > tokens remains the same; it's a matching definition not a
> > redefinition.
> 
> No, according to C11 6.10.3 p1 presence of whitespace is significant (its
> contents are not), and 6.10.3.5 example 6 corroborates that.  GCC, Clang,
> ICC and MSVC on Godbolt all agree with that.

Thanks for clarifying! I had forgotten this detail. It probably makes
sense to change it, then.

Rich


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

* Re: superfluous space char in marco
  2017-04-17 17:02     ` Rich Felker
@ 2017-04-17 17:29       ` Szabolcs Nagy
  2017-04-17 17:35         ` Rich Felker
  0 siblings, 1 reply; 6+ messages in thread
From: Szabolcs Nagy @ 2017-04-17 17:29 UTC (permalink / raw)
  To: musl

* Rich Felker <dalias@libc.org> [2017-04-17 13:02:08 -0400]:
> On Mon, Apr 17, 2017 at 06:28:58PM +0300, Alexander Monakov wrote:
> > On Mon, 17 Apr 2017, Rich Felker wrote:
> > > This is odd and looks like a gcc bug. Preprocessor macros definitions
> > > are sequences of PP tokens, not literal code strings, meaning that
> > > whitespace is irrelevant as long as the resulting sequence of PP
> > > tokens remains the same; it's a matching definition not a
> > > redefinition.
> > 
> > No, according to C11 6.10.3 p1 presence of whitespace is significant (its
> > contents are not), and 6.10.3.5 example 6 corroborates that.  GCC, Clang,
> > ICC and MSVC on Godbolt all agree with that.
> 
> Thanks for clarifying! I had forgotten this detail. It probably makes
> sense to change it, then.

linux uapi header has whitespace befor IFF_MASTER
if we match the definition with something i think
it should be the linux header not iproute2


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

* Re: superfluous space char in marco
  2017-04-17 17:29       ` Szabolcs Nagy
@ 2017-04-17 17:35         ` Rich Felker
  0 siblings, 0 replies; 6+ messages in thread
From: Rich Felker @ 2017-04-17 17:35 UTC (permalink / raw)
  To: musl

On Mon, Apr 17, 2017 at 07:29:19PM +0200, Szabolcs Nagy wrote:
> * Rich Felker <dalias@libc.org> [2017-04-17 13:02:08 -0400]:
> > On Mon, Apr 17, 2017 at 06:28:58PM +0300, Alexander Monakov wrote:
> > > On Mon, 17 Apr 2017, Rich Felker wrote:
> > > > This is odd and looks like a gcc bug. Preprocessor macros definitions
> > > > are sequences of PP tokens, not literal code strings, meaning that
> > > > whitespace is irrelevant as long as the resulting sequence of PP
> > > > tokens remains the same; it's a matching definition not a
> > > > redefinition.
> > > 
> > > No, according to C11 6.10.3 p1 presence of whitespace is significant (its
> > > contents are not), and 6.10.3.5 example 6 corroborates that.  GCC, Clang,
> > > ICC and MSVC on Godbolt all agree with that.
> > 
> > Thanks for clarifying! I had forgotten this detail. It probably makes
> > sense to change it, then.
> 
> linux uapi header has whitespace befor IFF_MASTER
> if we match the definition with something i think
> it should be the linux header not iproute2

Yes, the official Linux one, not iproute2's fork, is what we should
match, if anything.

Rich


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

end of thread, other threads:[~2017-04-17 17:35 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-16  7:58 superfluous space char in marco Syrone Wong
2017-04-17 14:48 ` Rich Felker
2017-04-17 15:28   ` Alexander Monakov
2017-04-17 17:02     ` Rich Felker
2017-04-17 17:29       ` Szabolcs Nagy
2017-04-17 17:35         ` Rich Felker

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

	https://git.vuxu.org/mirror/musl/

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 NNTP newsgroup(s).