nss_files build failure with GCC 17

Joseph Myers josmyers@redhat.com
Mon May 18 17:28:55 GMT 2026


Current GCC mainline produces a build failure in nss_files:

In file included from nss_files/files-service.c:30:
nss_files/files-service.c: In function '_nss_files_parse_servent':
nss_files/files-parse.c:165:22: error: use of logical '&&' with constant operand '10' [-Werror=constant-logical-operand]
  165 |       while (swallow && terminator_p (*endp));                                \
      |                      ^~
nss_files/files-parse.c:106:3: note: in definition of macro 'LINE_PARSER'
  106 |   BODY;                                                                       \
      |   ^~~~
nss_files/files-service.c:35:2: note: in expansion of macro 'INT_FIELD'
   35 |  INT_FIELD (result->s_port, ISSLASH, 10, 0, htons);
      |  ^~~~~~~~~
nss_files/files-parse.c:165:22: note: use '&' for bitwise operation
nss_files/files-parse.c:106:3: note: in definition of macro 'LINE_PARSER'
  106 |   BODY;                                                                       \
      |   ^~~~
nss_files/files-service.c:35:2: note: in expansion of macro 'INT_FIELD'
   35 |  INT_FIELD (result->s_port, ISSLASH, 10, 0, htons);
      |  ^~~~~~~~~

That is, the swallow argument to INT_FIELD is 10 and the base argument is 
0, and it's considered suspicious by the new warning (and indeed seems 
suspicious in this case) that a constant argument to && is not 0 or 1.

-- 
Joseph S. Myers
josmyers@redhat.com



More information about the Libc-alpha mailing list