sudo-project / sudo

Utility to execute a command as another user
https://www.sudo.ws
Other
1.15k stars 208 forks source link

configure: unsetenv return type check breaks build with clang 16 #302

Closed zlamas closed 9 months ago

zlamas commented 10 months ago

When building 1.9.14p3 on Gentoo with clang 16, configure returns an incorrect result for this check:

checking whether unsetenv returns void... yes

Configure log:

configure:23051: checking whether unsetenv returns void
configure:23077: clang -o conftest -O3 -pipe -march=bonnell -mfpmath=sse -flto=thin -fno-plt -fno-stack-protector -fno-stack-clash-protection -fomit-frame-pointer -fno-pic -fno-pie -DZLIB_CONST -Wl,-O1 -Wl,--as-needed -Wl,-O2,--as-needed -no-pie -Wl,--no-undefined conftest.c  >&5
conftest.c:165:13: error: a function declaration without a prototype is deprecated in all versions of C and is treated as a zero-parameter prototype in C2x, conflicting with a previous declaration [-Werror,-Wdeprecated-non-prototype]
        int unsetenv();
            ^
/usr/include/stdlib.h:677:12: note: conflicting prototype is here
extern int unsetenv (const char *__name) __THROW __nonnull ((1));
           ^
1 error generated.
configure:23077: $? = 1
configure: program exited with status 1

This then causes the build to fail:

./env_hooks.c:294:32: error: conflicting types for 'unsetenv'
sudo_dso_public UNSETENV_RTYPE unsetenv(const char *var);
                               ^
/usr/include/stdlib.h:677:12: note: previous declaration is here
extern int unsetenv (const char *__name) __THROW __nonnull ((1));
           ^
./env_hooks.c:297:1: error: conflicting types for 'unsetenv'
unsetenv(const char *var)
^
/usr/include/stdlib.h:677:12: note: previous declaration is here
extern int unsetenv (const char *__name) __THROW __nonnull ((1));
           ^
2 errors generated

config.log build.log

millert commented 10 months ago

This should be fixed by 1eb4392

zlamas commented 10 months ago

It's fixed now, thanks!