#9230 build failure against gcc < 11
Closed: fixed by frenaud. Opened by slev.

I'm backporting ipa-4.9.10 on platform having gcc 10 and the build fails with:

make[3]: Entering directory '/usr/src/RPM/BUILD/freeipa-4.9.10/daemons/ipa-otpd'
x86_64-alt-linux-gcc -DHAVE_CONFIG_H -I. -I../..  -I../../util  -I/usr/include/nspr -p
ipe -frecord-gcc-switches -Wall -g -O2 -D__STDC_WANT_LIB_EXT1__=1 -D_DEFAULT_SOURCE=1 
-D_POSIX_C_SOURCE=200809L -Werror=implicit-function-declaration -c -o oauth2.o oauth2.
c
oauth2.c: In function 'oauth2_on_child_readable':
oauth2.c:322:38: error: parameter name omitted
  322 | static void oauth2_on_child_readable(verto_ctx *, verto_ev *ev)
      |                                      ^~~~~~~~~~~
make[3]: *** [Makefile:791: oauth2.o] Error 1

https://gcc.gnu.org/gcc-11/changes.html:

Several new features from the upcoming C2X revision of the ISO C standard are supported with -std=c2x and -std=gnu2x. Some of these features are also supported as extensions when compiling for older language versions. In addition to the features listed, some features previously supported as extensions and now added to the C standard are enabled by default in C2X mode and not diagnosed with -std=c2x -Wpedantic.
...
As in C++, function definitions no longer need to give names for unused function parameters.
...


#new_contributor_friendly if somebody wants.

Interesting that on RHEL8 with gcc 8.5 I don't get this issue. I get other warnings but not this error ;)

Making all in ipa-otpd
make[3]: Entering directory '/builddir/build/BUILD/freeipa-4.9.10/daemons/ipa-otpd'
gcc -DHAVE_CONFIG_H -I. -I../..  -I../../util  -I/usr/include/nspr4  -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D__STDC_WANT_LIB_EXT1__=1 -D_DEFAULT_SOURCE=1 -D_POSIX_C_SOURCE=200809L -Werror=implicit-function-declaration -c -o bind.o bind.c
gcc -DHAVE_CONFIG_H -I. -I../..  -I../../util  -I/usr/include/nspr4  -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D__STDC_WANT_LIB_EXT1__=1 -D_DEFAULT_SOURCE=1 -D_POSIX_C_SOURCE=200809L -Werror=implicit-function-declaration -c -o forward.o forward.c
gcc -DHAVE_CONFIG_H -I. -I../..  -I../../util  -I/usr/include/nspr4  -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D__STDC_WANT_LIB_EXT1__=1 -D_DEFAULT_SOURCE=1 -D_POSIX_C_SOURCE=200809L -Werror=implicit-function-declaration -c -o main.o main.c
gcc -DHAVE_CONFIG_H -I. -I../..  -I../../util  -I/usr/include/nspr4  -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D__STDC_WANT_LIB_EXT1__=1 -D_DEFAULT_SOURCE=1 -D_POSIX_C_SOURCE=200809L -Werror=implicit-function-declaration -c -o parse.o parse.c
gcc -DHAVE_CONFIG_H -I. -I../..  -I../../util  -I/usr/include/nspr4  -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D__STDC_WANT_LIB_EXT1__=1 -D_DEFAULT_SOURCE=1 -D_POSIX_C_SOURCE=200809L -Werror=implicit-function-declaration -c -o query.o query.c
gcc -DHAVE_CONFIG_H -I. -I../..  -I../../util  -I/usr/include/nspr4  -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D__STDC_WANT_LIB_EXT1__=1 -D_DEFAULT_SOURCE=1 -D_POSIX_C_SOURCE=200809L -Werror=implicit-function-declaration -c -o queue.o queue.c
gcc -DHAVE_CONFIG_H -I. -I../..  -I../../util  -I/usr/include/nspr4  -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D__STDC_WANT_LIB_EXT1__=1 -D_DEFAULT_SOURCE=1 -D_POSIX_C_SOURCE=200809L -Werror=implicit-function-declaration -c -o stdio.o stdio.c
gcc -DHAVE_CONFIG_H -I. -I../..  -I../../util  -I/usr/include/nspr4  -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D__STDC_WANT_LIB_EXT1__=1 -D_DEFAULT_SOURCE=1 -D_POSIX_C_SOURCE=200809L -Werror=implicit-function-declaration -c -o oauth2.o oauth2.c
parse.c: In function 'otpd_parse_user':
parse.c:124:8: warning: 'buf' may be used uninitialized in this function [-Wmaybe-uninitialized]
     if (ret != 0 && buf != NULL) {
        ^
parse.c:77:12: note: 'buf' was declared here
     char **buf;
            ^~~
oauth2.c: In function 'oauth2':
oauth2.c:468:27: warning: 'saved_item' may be used uninitialized in this function [-Wmaybe-uninitialized]
     child_ctx->saved_item = saved_item;
     ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~

May be this is gcc 10 specific?

PR: https://github.com/freeipa/freeipa/pull/6428

Metadata Update from @abbra:
- Custom field on_review adjusted to https://github.com/freeipa/freeipa/pull/6428
- Issue assigned to abbra

I checked several previous gccs against omitted func's param and default compiler options, build result:
8.3.1 (Fedora 29) - failure
9.3.1 (Fedora 30) - failure
10.3.1 (Fedora 33) - failure
11.3.1 (Fedora 34) - success

master:

  • ad8f90f816b044be2fac52cb12f68a8a59f0e771 ipa-otpd: initialize local pointers and handle gcc 10

ipa-4-9:

  • 9290aa5500f752d0eedabdfc92c9fe6c0ee743b8 ipa-otpd: initialize local pointers and handle gcc 10

ipa-4-10:

  • 9441d7ed1ac67dc74ca6177b474d10da97b06a2f ipa-otpd: initialize local pointers and handle gcc 10

Metadata Update from @frenaud:
- Issue close_status updated to: fixed
- Issue status updated to: Closed (was: Open)

Metadata