bug-gnulib
[Top][All Lists]
Advanced

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

Re: Fwd: GnuTLS 3.6.12 patch for OS X 10.9


From: Paul Eggert
Subject: Re: Fwd: GnuTLS 3.6.12 patch for OS X 10.9
Date: Mon, 3 Feb 2020 09:24:05 -0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1

Re the message forwarded below. First I don't see a copy of this message at <https://lists.gnu.org/r/gnutls-devel/2015-02/index.html> so I'm taking the liberty of copying the entire thing to address@hidden.

Second, your patch (attached) doesn't look right. config.h should not #define __has_attribute because too much code (perhaps unwisely) defaults __has_attribute to something other than just 0, and relies on doing this, and if config.h defaults it to 0 then the code won't work. (The advice about defaulting __has_attribute to 0 in https://clang.llvm.org/docs/LanguageExtensions.html is wrong for GCC.)

Third, the proposed patch uses __has_attribute(__noreturn__) to decide whether _Noreturn is supported, which doesn't sound right. I expect that Clang historically has had modes in which __attribute__((__noreturn__)) worked and _Noreturn didn't, or vice versa.

If you could let us know exactly when Clang supports _Noreturn and when it doesn't (C++ vs C, which version of Clang, which other C preprocessor macros matter?) we could come up with a better patch.


---------- Forwarded message ---------
From: Jeffrey Walton <address@hidden>
Date: Mon, Feb 3, 2020 at 3:12 AM
Subject: GnuTLS 3.6.12 patch for OS X 10.9
To: <address@hidden>

Hi Everyone,

I'm working from the GnuTLS 3.6.12 release tarball on OS X 10.9.

The build is failing due to the handling of _Noreturn in config.h and
gl/_Noreturn.h. An example of the error is shown below.

The attached patch fixes the build. In the case of OS X 10.9 with
Clang, the compiler already knows what to do with
__attribute__((__noreturn__)). The machinery should not modify
anything.

gcc -DHAVE_CONFIG_H -I. -I..  -I./gl -I./gl -I./../lib/includes
-I./../lib/includes -I./../libdane/includes -I./../extra/includes
-I../src/libopts -I./libopts  -I/usr/local/include -DNDEBUG
-fno-common -Wall   -g2 -O2 -march=native -fPIC -pthread -MT tests.o
-MD -MP -MF $depbase.Tpo -c -o tests.o tests.c &&\
mv -f $depbase.Tpo $depbase.Po
In file included from psk.c:50:
In file included from ./gl/unistd.h:40:
/usr/include/unistd.h:424:18: error: use of undeclared identifier '__noreturn__'
void     _exit(int) __dead2;
                     ^
/usr/include/sys/cdefs.h:135:33: note: expanded from macro '__dead2'
#define __dead2         __attribute__((noreturn))
                                        ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/6.0/include/stdnoreturn.h:27:18:
note:
       expanded from macro 'noreturn'
#define noreturn _Noreturn
                  ^
../config.h:1828:37: note: expanded from macro '_Noreturn'
#  define _Noreturn __attribute__ ((__noreturn__))
                                     ^
In file included from psk.c:50:
In file included from ./gl/unistd.h:40:
/usr/include/unistd.h:640:18: error: use of undeclared identifier '__noreturn__'
void     _Exit(int) __dead2;
                     ^
/usr/include/sys/cdefs.h:135:33: note: expanded from macro '__dead2'
#define __dead2         __attribute__((noreturn))
                                        ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/6.0/include/stdnoreturn.h:27:18:
note:
       expanded from macro 'noreturn'
#define noreturn _Noreturn
                  ^
../config.h:1828:37: note: expanded from macro '_Noreturn'
#  define _Noreturn __attribute__ ((__noreturn__))
                                     ^
2 errors generated.
gmake[4]: *** [Makefile:2121: psk.o] Error 1
gmake[4]: *** Waiting for unfinished jobs....

If you don't like the use of __has_attribute, then the following
defines may be helpful to untangle things (or make the fur ball
bigger):

$ gcc -dM -E - < /dev/null | grep -i -E 'clang|llvm|apple|gnu'
#define __APPLE_CC__ 6000
#define __APPLE__ 1
#define __GNUC_MINOR__ 2
#define __GNUC_PATCHLEVEL__ 1
#define __GNUC_STDC_INLINE__ 1
#define __GNUC__ 4
#define __VERSION__ "4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)"
#define __apple_build_version__ 6000057
#define __clang__ 1
#define __clang_major__ 6
#define __clang_minor__ 0
#define __clang_patchlevel__ 0
#define __clang_version__ "6.0 (clang-600.0.57)"
#define __llvm__ 1

Jeff


Attachment: gnutls.patch
Description: Text Data


reply via email to

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