paul-j-lucas / cdecl

Composing and deciphering C (or C++) declarations or casts, aka ‘‘gibberish.’’
GNU General Public License v3.0
90 stars 11 forks source link

10.3 FTBFS #12

Closed jengelh closed 3 years ago

jengelh commented 3 years ago
[   22s] gcc -DHAVE_CONFIG_H -I.  -I../lib -I../lib -I/include   -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -flto=auto -g  -Wcast-align -Wconversion -Wextra -Wfloat-equal -Wimplicit-fallthrough -Wredundant-decls -Wshadow -Wsign-compare -Wsign-conversion -Wuninitialized -Wunreachable-code -Wunused -Wwrite-strings -c -o lexer.o lexer.c
[   22s] In file included from lexer.c:18:
[   22s] ../lib/string.h:959:1: error: expected ',' or ';' before '_GL_ATTRIBUTE_MALLOC'
[   22s]   959 | _GL_FUNCDECL_SYS (strdup, char *,
[   22s]       | ^~~~~~~~~~~~~~~~

https://build.opensuse.org/package/live_build_log/devel:tools/cdecl/openSUSE_Tumbleweed/x86_64

gcc -E has to say

extern int _gl_cxxalias_dummy;
# 959 "../lib/string.h" 3
extern char * strdup (char const *__s) __attribute__ ((__nonnull__ (1))) _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
paul-j-lucas commented 3 years ago

This looks to be a problem with the upstream GnuLib since I'm not the author of lib/string.h. I've test compiled this on a few Linux x86_64 platforms, FreeBSD, Solaris (Sparc, AMD, and Intel), and macOS (Intel and M1) and all compile just fine. I don't have access to any OpenSuse Linux platforms to build.

jengelh commented 3 years ago

Both src/lexer.c and lib/string.h have no #include "config.h", so they do not know the definition of _GL_ATTRIBUTE_MALLOC. lib/string.h happens to redefine _GL_ATTRIBUTE_PURE on its own, which is why it only fails from the strdup line onwards, and not with any of the prior prototypes.

paul-j-lucas commented 3 years ago

lexer.l has #include "pjl_config.h" as the very first #include since cdecl's code always uses pjl_config.h (for reasons explained in its comments) and not config.h directly.

jengelh commented 3 years ago
#  if (!1 || __GNUC__ >= 11) && !defined strdup
_GL_FUNCDECL_SYS (strdup, char *,
                  (char const *__s)
                  _GL_ARG_NONNULL ((1))
                  _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
#  endif

Tumbleweed uses gcc 11, which is why it only fails on that version of SUSE. (The older releases have gcc7.)

paul-j-lucas commented 3 years ago

It's still looking like an issue with the upstream GnuLib and not cdecl. The GnuLib maintainers occasionally break things.

paul-j-lucas commented 3 years ago

Were you going to raise the issue with GnuLib?

jengelh commented 3 years ago

I determined the author of the lines that cause me this trible (@bhaible) and sent a private mail now.

paul-j-lucas commented 3 years ago

If you could keep me posted, perhaps paste a link to a created issue, then I'd know when the upstream issue is fixed so I could update the copy of GnuLib inside cdecl, that would be good.

bhaible commented 3 years ago

Should be fixed in Gnulib, through https://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=commitdiff;h=354f27fea9bd4ecb53980de6bd374434a204afc5 .

paul-j-lucas commented 3 years ago

I've pulld from GnuLib, updated cdecl, and pushd to master. Try building master. Since it's not a released build, you'll need to run bootstrap manually to generate configure. Let me know if it's fixed.

paul-j-lucas commented 3 years ago

Confirmed as fixed.