bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Portability issues of inline on macOS with GCC11


From: Akim Demaille
Subject: Portability issues of inline on macOS with GCC11
Date: Mon, 13 Sep 2021 07:14:52 +0200

Hi,

If I try to update gnulib in Bison, I have the following errors using GCC 
11.2.0 on macOS.

> In file included from /Users/akim/src/gnu/bison/src/system.h:74,
>                  from /Users/akim/src/gnu/bison/src/Sbitset.c:21:
> /Users/akim/src/gnu/bison/lib/xalloc.h:139:1: error: 'maybe_unused' attribute 
> ignored [-Werror=attributes]
>   139 | XALLOC_INLINE void *xnrealloc (void *p, size_t n, size_t s)
>       | ^~~~~~~~~~~~~
> /Users/akim/src/gnu/bison/lib/xalloc.h:139:15: error: expected identifier or 
> '(' before 'void'
>   139 | XALLOC_INLINE void *xnrealloc (void *p, size_t n, size_t s)
>       |               ^~~~
> /Users/akim/src/gnu/bison/lib/xalloc.h:141:1: error: 'maybe_unused' attribute 
> ignored [-Werror=attributes]
>   141 | XALLOC_INLINE void *
>       | ^~~~~~~~~~~~~
> /Users/akim/src/gnu/bison/lib/xalloc.h:141:15: error: expected identifier or 
> '(' before 'void'
>   141 | XALLOC_INLINE void *
>       |               ^~~~
> cc1: all warnings being treated as errors
> gmake[2]: *** [Makefile:8758: src/bison-Sbitset.o] Error 1

The preprocessed source is

> static [[__maybe_unused__]] void *xnrealloc (void *p, size_t n, size_t s)
>   __attribute__ ((__alloc_size__ (2, 3)));
> static [[__maybe_unused__]] void *
> xnrealloc (void *p, size_t n, size_t s)
> {
>   return xreallocarray (p, n, s);
> }

As a matter of fact, there are many similar failures.

> In file included from /Users/akim/src/gnu/bison/lib/gl_map.c:21:
> /Users/akim/src/gnu/bison/lib/gl_map.h:263:1: warning: 'maybe_unused' 
> attribute ignored [-Wattributes]
>   263 | gl_map_t
>       | ^~~~~~~~
> /Users/akim/src/gnu/bison/lib/gl_map.h:263:1: error: expected identifier or 
> '(' before 'gl_map_t'

The preprocessor gives:

static [[__maybe_unused__]]

gl_map_t
gl_map_nx_create_empty (gl_map_implementation_t implementation,
                        gl_mapkey_equals_fn equals_fn,
                        gl_mapkey_hashcode_fn hashcode_fn,
                        gl_mapkey_dispose_fn kdispose_fn,
                        gl_mapvalue_dispose_fn vdispose_fn)
{
  return implementation->nx_create_empty (implementation,
                                          equals_fn, hashcode_fn,
                                          kdispose_fn, vdispose_fn);
}

The command is:

> ccache gcc-mp-11 -DEXEEXT=\"\"   -I. -I./lib -I/Users/akim/src/gnu/bison 
> -I/Users/akim/src/gnu/bison/lib -DINSTALLDIR=\"/opt/gostai/bin\" -isystem 
> /opt/gostai/include -isystem /opt/local/include -I/opt/gostai/include 
> -I/opt/local/include -Wunreachable-code -Wall -Wextra -Wcast-align 
> -Wchar-subscripts -Wformat -Wimplicit-fallthrough -Wmismatched-dealloc 
> -Wnull-dereference -Wno-sign-compare -Wpointer-arith -Wshadow 
> -Wstrict-aliasing -Wwrite-strings -Wbad-function-cast -Wmissing-prototypes 
> -Wstrict-prototypes  -Werror -ggdb -MT src/bison-AnnotationList.o -MD -MP -MF 
> src/.deps/bison-AnnotationList.Tpo -c -o src/bison-AnnotationList.o `test -f 
> 'src/AnnotationList.c' || echo 
> '/Users/akim/src/gnu/bison/'`src/AnnotationList.c
> In file included from /Users/akim/src/gnu/bison/lib/bitset/base.h:32,
>                  from /Users/akim/src/gnu/bison/lib/bitset.h:31,
>                  from /Users/akim/src/gnu/bison/lib/bitsetv.h:24,
>                  from /Users/akim/src/gnu/bison/src/AnnotationList.h:23,
>                  from /Users/akim/src/gnu/bison/src/AnnotationList.c:22:
> /Users/akim/src/gnu/bison/lib/xalloc.h:139:1: error: 'maybe_unused' attribute 
> ignored [-Werror=attributes]
>   139 | XALLOC_INLINE void *xnrealloc (void *p, size_t n, size_t s)
>       | ^~~~~~~~~~~~~
> /Users/akim/src/gnu/bison/lib/xalloc.h:139:15: error: expected identifier or 
> '(' before 'void'
>   139 | XALLOC_INLINE void *xnrealloc (void *p, size_t n, size_t s)
>       |               ^~~~
> /Users/akim/src/gnu/bison/lib/xalloc.h:141:1: error: 'maybe_unused' attribute 
> ignored [-Werror=attributes]
>   141 | XALLOC_INLINE void *
>       | ^~~~~~~~~~~~~
> /Users/akim/src/gnu/bison/lib/xalloc.h:141:15: error: expected identifier or 
> '(' before 'void'
>   141 | XALLOC_INLINE void *
>       |               ^~~~
> cc1: all warnings being treated as errors


I'm unsure how you would like to address this.

Cheers!


> /Users/akim/src/gnu/bison/lib/gl_map.h:275:1: warning: 'maybe_unused' 
> attribute ignored [-Wattributes]
>   275 | GL_MAP_INLINE size_t
>       | ^~~~~~~~~~~~~
> /Users/akim/src/gnu/bison/lib/gl_map.h:275:15: error: expected identifier or 
> '(' before 'size_t'
>   275 | GL_MAP_INLINE size_t
>       |               ^~~~~~
> /Users/akim/src/gnu/bison/lib/gl_map.h:281:1: warning: 'maybe_unused' 
> attribute ignored [-Wattributes]
>   281 | GL_MAP_INLINE bool
>       | ^~~~~~~~~~~~~
> In file included from /Users/akim/src/gnu/bison/lib/gl_map.h:21,
>                  from /Users/akim/src/gnu/bison/lib/gl_map.c:21:
> /Users/akim/src/gnu/bison/lib/gl_map.h:281:15: error: expected identifier or 
> '(' before '_Bool'
>   281 | GL_MAP_INLINE bool
>       |               ^~~~
> In file included from /Users/akim/src/gnu/bison/lib/gl_map.c:21:
> /Users/akim/src/gnu/bison/lib/gl_map.h:288:1: warning: 'maybe_unused' 
> attribute ignored [-Wattributes]
>   288 | _GL_ATTRIBUTE_NODISCARD GL_MAP_INLINE int
>       | ^~~~~~~~~~~~~~~~~~~~~~~
> /Users/akim/src/gnu/bison/lib/gl_map.h:288:39: error: expected identifier or 
> '(' before 'int'
>   288 | _GL_ATTRIBUTE_NODISCARD GL_MAP_INLINE int
>       |                                       ^~~
> /Users/akim/src/gnu/bison/lib/gl_map.h:296:1: warning: 'maybe_unused' 
> attribute ignored [-Wattributes]
>   296 | GL_MAP_INLINE bool
>       | ^~~~~~~~~~~~~
> In file included from /Users/akim/src/gnu/bison/lib/gl_map.h:21,
>                  from /Users/akim/src/gnu/bison/lib/gl_map.c:21:
> /Users/akim/src/gnu/bison/lib/gl_map.h:296:15: error: expected identifier or 
> '(' before '_Bool'
>   296 | GL_MAP_INLINE bool
>       |               ^~~~
> In file included from /Users/akim/src/gnu/bison/lib/gl_map.c:21:
> /Users/akim/src/gnu/bison/lib/gl_map.h:303:1: warning: 'maybe_unused' 
> attribute ignored [-Wattributes]
>   303 | GL_MAP_INLINE void
>       | ^~~~~~~~~~~~~
> /Users/akim/src/gnu/bison/lib/gl_map.h:303:15: error: expected identifier or 
> '(' before 'void'
>   303 | GL_MAP_INLINE void
>       |               ^~~~
> /Users/akim/src/gnu/bison/lib/gl_map.h:309:1: warning: 'maybe_unused' 
> attribute ignored [-Wattributes]
>   309 | GL_MAP_INLINE gl_map_iterator_t
>       | ^~~~~~~~~~~~~
> /Users/akim/src/gnu/bison/lib/gl_map.h:309:15: error: expected identifier or 
> '(' before 'gl_map_iterator_t'
>   309 | GL_MAP_INLINE gl_map_iterator_t
>       |               ^~~~~~~~~~~~~~~~~
> /Users/akim/src/gnu/bison/lib/gl_map.h:315:1: warning: 'maybe_unused' 
> attribute ignored [-Wattributes]
>   315 | GL_MAP_INLINE bool
>       | ^~~~~~~~~~~~~
> In file included from /Users/akim/src/gnu/bison/lib/gl_map.h:21,
>                  from /Users/akim/src/gnu/bison/lib/gl_map.c:21:
> /Users/akim/src/gnu/bison/lib/gl_map.h:315:15: error: expected identifier or 
> '(' before '_Bool'
>   315 | GL_MAP_INLINE bool
>       |               ^~~~
> In file included from /Users/akim/src/gnu/bison/lib/gl_map.c:21:
> /Users/akim/src/gnu/bison/lib/gl_map.h:322:1: warning: 'maybe_unused' 
> attribute ignored [-Wattributes]
>   322 | GL_MAP_INLINE void
>       | ^~~~~~~~~~~~~
> /Users/akim/src/gnu/bison/lib/gl_map.h:322:15: error: expected identifier or 
> '(' before 'void'
>   322 | GL_MAP_INLINE void
>       |               ^~~~
> /Users/akim/src/gnu/bison/lib/gl_map.h:331:1: warning: 'maybe_unused' 
> attribute ignored [-Wattributes]
>   331 | GL_MAP_INLINE const void *
>       | ^~~~~~~~~~~~~
> /Users/akim/src/gnu/bison/lib/gl_map.h:331:15: error: expected identifier or 
> '(' before 'const'
>   331 | GL_MAP_INLINE const void *
>       |               ^~~~~
> /Users/akim/src/gnu/bison/lib/gl_map.h:339:1: warning: 'maybe_unused' 
> attribute ignored [-Wattributes]
>   339 | _GL_ATTRIBUTE_NODISCARD GL_MAP_INLINE int
>       | ^~~~~~~~~~~~~~~~~~~~~~~
> /Users/akim/src/gnu/bison/lib/gl_map.h:339:39: error: expected identifier or 
> '(' before 'int'
>   339 | _GL_ATTRIBUTE_NODISCARD GL_MAP_INLINE int
>       |                                       ^~~
> /Users/akim/src/gnu/bison/lib/gl_map.h:354:1: warning: 'maybe_unused' 
> attribute ignored [-Wattributes]
>   354 | GL_MAP_INLINE bool
>       | ^~~~~~~~~~~~~
> In file included from /Users/akim/src/gnu/bison/lib/gl_map.h:21,
>                  from /Users/akim/src/gnu/bison/lib/gl_map.c:21:
> /Users/akim/src/gnu/bison/lib/gl_map.h:354:15: error: expected identifier or 
> '(' before '_Bool'
>   354 | GL_MAP_INLINE bool
>       |               ^~~~
> gmake[2]: *** [Makefile:6000: lib/libbison_a-gl_map.o] Error 1
> gmake[2]: *** Waiting for unfinished jobs....
> In file included from /Users/akim/src/gnu/bison/lib/mbchar.c:23:
> /Users/akim/src/gnu/bison/lib/mbchar.h:239:1: warning: 'maybe_unused' 
> attribute ignored [-Wattributes]
>   239 | MBCHAR_INLINE int
>       | ^~~~~~~~~~~~~
> /Users/akim/src/gnu/bison/lib/mbchar.h:239:15: error: expected identifier or 
> '(' before 'int'
>   239 | MBCHAR_INLINE int
>       |               ^~~
> /Users/akim/src/gnu/bison/lib/mbchar.h:260:1: warning: 'maybe_unused' 
> attribute ignored [-Wattributes]
>   260 | MBCHAR_INLINE void
>       | ^~~~~~~~~~~~~
> /Users/akim/src/gnu/bison/lib/mbchar.h:260:15: error: expected identifier or 
> '(' before 'void'
>   260 | MBCHAR_INLINE void
>       |               ^~~~
> /Users/akim/src/gnu/bison/lib/mbchar.h:308:1: warning: 'maybe_unused' 
> attribute ignored [-Wattributes]
>   308 | MBCHAR_INLINE bool
>       | ^~~~~~~~~~~~~
> In file included from /Users/akim/src/gnu/bison/lib/mbchar.h:147,
>                  from /Users/akim/src/gnu/bison/lib/mbchar.c:23:
> /Users/akim/src/gnu/bison/lib/mbchar.h:308:15: error: expected identifier or 
> '(' before '_Bool'
>   308 | MBCHAR_INLINE bool
>       |               ^~~~
> gmake[2]: *** [Makefile:6028: lib/libbison_a-mbchar.o] Error 1
> In file included from /Users/akim/src/gnu/bison/lib/mbfile.h:56,
>                  from /Users/akim/src/gnu/bison/lib/mbfile.c:20:
> /Users/akim/src/gnu/bison/lib/mbchar.h:239:1: warning: 'maybe_unused' 
> attribute ignored [-Wattributes]
>   239 | MBCHAR_INLINE int
>       | ^~~~~~~~~~~~~
> /Users/akim/src/gnu/bison/lib/mbchar.h:239:15: error: expected identifier or 
> '(' before 'int'
>   239 | MBCHAR_INLINE int
>       |               ^~~
> /Users/akim/src/gnu/bison/lib/mbchar.h:260:1: warning: 'maybe_unused' 
> attribute ignored [-Wattributes]
>   260 | MBCHAR_INLINE void
>       | ^~~~~~~~~~~~~
> /Users/akim/src/gnu/bison/lib/mbchar.h:260:15: error: expected identifier or 
> '(' before 'void'
>   260 | MBCHAR_INLINE void
>       |               ^~~~
> /Users/akim/src/gnu/bison/lib/mbchar.h:308:1: warning: 'maybe_unused' 
> attribute ignored [-Wattributes]
>   308 | MBCHAR_INLINE bool
>       | ^~~~~~~~~~~~~
> In file included from /Users/akim/src/gnu/bison/lib/mbfile.h:51,
>                  from /Users/akim/src/gnu/bison/lib/mbfile.c:20:
> /Users/akim/src/gnu/bison/lib/mbchar.h:308:15: error: expected identifier or 
> '(' before '_Bool'
>   308 | MBCHAR_INLINE bool
>       |               ^~~~
> In file included from /Users/akim/src/gnu/bison/lib/mbfile.c:20:
> /Users/akim/src/gnu/bison/lib/mbfile.h:76:1: warning: 'maybe_unused' 
> attribute ignored [-Wattributes]
>    76 | MBFILE_INLINE void
>       | ^~~~~~~~~~~~~
> /Users/akim/src/gnu/bison/lib/mbfile.h:76:15: error: expected identifier or 
> '(' before 'void'
>    76 | MBFILE_INLINE void
>       |               ^~~~
> /Users/akim/src/gnu/bison/lib/mbfile.h:219:1: warning: 'maybe_unused' 
> attribute ignored [-Wattributes]
>   219 | MBFILE_INLINE void
>       | ^~~~~~~~~~~~~
> /Users/akim/src/gnu/bison/lib/mbfile.h:219:15: error: expected identifier or 
> '(' before 'void'
>   219 | MBFILE_INLINE void
>       |               ^~~~




reply via email to

[Prev in Thread] Current Thread [Next in Thread]