From patchwork Sun Aug 31 20:55:53 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mikulas Patocka X-Patchwork-Id: 2606 Received: (qmail 6884 invoked by alias); 31 Aug 2014 20:55:58 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 6873 invoked by uid 89); 31 Aug 2014 20:55:57 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.6 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Date: Sun, 31 Aug 2014 16:55:53 -0400 (EDT) From: Mikulas Patocka To: Richard Henderson , libc-alpha@sourceware.org Subject: [PATCH] fix include files to support non-GNU compilers Message-ID: User-Agent: Alpine 2.02 (LRH 1266 2009-07-14) MIME-Version: 1.0 Hi This patch fixes glibc include files on Alpha architecture to support compilers without GNU extensions. There was some support for non-GNU compilers, but it bit-rotted over time. Specifically, this patch supports the Compaq C compiler (downloadable from ftp://ftp.compaq.com/pub/products/C-CXX/linux/ ). Note that in some circumstances Compaq C produces faster code than GCC, so it still makes sense to use it. (another reason to use it is to verify that the code being compiled is portable C, without GNU extensions) The Compaq C requires EGCS to be also installed (it uses some of its include files), so this patch fixes includes for EGCS as well. Mikulas stdio.h: egcs doesn't respond to _VA_LIST_DEFINED. We only use this code path on reasonably new gcc. limits.h: __LONG_LONG_MAX__ is not defined by egcs. So we can't use it in the definition of LLONG_MAX. math.h: __REDIRECT_NTH is not defined on non-GNU compilers. In this case, we don't declare long double redirection and instead declare a dummy "struct __empty__declaration__" (we must declare something because C doesn't allow stray semicolon in the program). alpha-linux-gnu/sys/cdefs.h: for non-GNU compilers, we must define empty __LDBL_REDIR1_DECL alpha-linux-gnu/bits/wchar-ldbl.h: remove spurious semicolons. The semicolon already exists at the end of __LDBL_REDIR_DECL and __LDBL_REDIR1_DECL definition. alpha-linux-gnu/bits/wchar.h: DEC C doesn't handle L'\0' in preprocessor expression. alpha-linux-gnu/bits/pthreadtypes.h: alpha-linux-gnu/bits/semaphore.h: netinet/in.h: __align is a keyword for the DEC C compiler. Use __align_ instead. --- bits/wchar.h | 4 +++ include/limits.h | 6 +++- inet/netinet/in.h | 2 - libio/stdio.h | 3 +- math/math.h | 7 ++++- misc/sys/cdefs.h | 1 sysdeps/unix/sysv/linux/alpha/bits/pthreadtypes.h | 18 +++++++------- sysdeps/unix/sysv/linux/alpha/bits/semaphore.h | 2 - wcsmbs/bits/wchar-ldbl.h | 28 +++++++++++----------- 9 files changed, 43 insertions(+), 28 deletions(-) Index: glibc/libio/stdio.h =================================================================== --- glibc.orig/libio/stdio.h +++ glibc/libio/stdio.h @@ -74,7 +74,7 @@ typedef struct _IO_FILE __FILE; #include #if defined __USE_XOPEN || defined __USE_XOPEN2K8 -# ifdef __GNUC__ +# if defined(__GNUC__) && __GNUC__ >= 3 # ifndef _VA_LIST_DEFINED typedef _G_va_list va_list; # define _VA_LIST_DEFINED Index: glibc/include/limits.h =================================================================== --- glibc.orig/include/limits.h +++ glibc/include/limits.h @@ -131,7 +131,11 @@ # define LLONG_MIN (-LLONG_MAX-1) # endif # ifndef LLONG_MAX -# define LLONG_MAX __LONG_LONG_MAX__ +# ifdef __LONG_LONG_MAX__ +# define LLONG_MAX __LONG_LONG_MAX__ +# else +# define LLONG_MAX 9223372036854775807LL +# endif # endif # ifndef ULLONG_MAX # define ULLONG_MAX (LLONG_MAX * 2ULL + 1) Index: glibc/math/math.h =================================================================== --- glibc.orig/math/math.h +++ glibc/math/math.h @@ -111,9 +111,14 @@ extern long double __REDIRECT_NTH (nextt # endif # undef __MATHDECL_1 -# define __MATHDECL_2(type, function,suffix, args, alias) \ +# ifdef __REDIRECT_NTH +# define __MATHDECL_2(type, function,suffix, args, alias) \ extern type __REDIRECT_NTH(__MATH_PRECNAME(function,suffix), \ args, alias) +# else +# define __MATHDECL_2(type, function,suffix, args, alias) \ + struct __empty__declaration__ +# endif # define __MATHDECL_1(type, function,suffix, args) \ __MATHDECL_2(type, function,suffix, args, __CONCAT(function,suffix)) # endif Index: glibc/misc/sys/cdefs.h =================================================================== --- glibc.orig/misc/sys/cdefs.h +++ glibc/misc/sys/cdefs.h @@ -419,6 +419,7 @@ # define __LDBL_REDIR1_NTH(name, proto, alias) name proto __THROW # define __LDBL_REDIR_NTH(name, proto) name proto __THROW # define __LDBL_REDIR_DECL(name) +# define __LDBL_REDIR1_DECL(name, alias) # ifdef __REDIRECT # define __REDIRECT_LDBL(name, proto, alias) __REDIRECT (name, proto, alias) # define __REDIRECT_NTH_LDBL(name, proto, alias) \ Index: glibc/wcsmbs/bits/wchar-ldbl.h =================================================================== --- glibc.orig/wcsmbs/bits/wchar-ldbl.h +++ glibc/wcsmbs/bits/wchar-ldbl.h @@ -22,12 +22,12 @@ #if defined __USE_ISOC95 || defined __USE_UNIX98 __BEGIN_NAMESPACE_C99 -__LDBL_REDIR_DECL (fwprintf); -__LDBL_REDIR_DECL (wprintf); -__LDBL_REDIR_DECL (swprintf); -__LDBL_REDIR_DECL (vfwprintf); -__LDBL_REDIR_DECL (vwprintf); -__LDBL_REDIR_DECL (vswprintf); +__LDBL_REDIR_DECL (fwprintf) +__LDBL_REDIR_DECL (wprintf) +__LDBL_REDIR_DECL (swprintf) +__LDBL_REDIR_DECL (vfwprintf) +__LDBL_REDIR_DECL (vwprintf) +__LDBL_REDIR_DECL (vswprintf) # if defined __USE_ISOC99 && !defined __USE_GNU \ && !defined __REDIRECT \ && (defined __STRICT_ANSI__ || defined __USE_XOPEN2K) @@ -35,31 +35,31 @@ __LDBL_REDIR1_DECL (fwscanf, __nldbl___i __LDBL_REDIR1_DECL (wscanf, __nldbl___isoc99_wscanf) __LDBL_REDIR1_DECL (swscanf, __nldbl___isoc99_swscanf) # else -__LDBL_REDIR_DECL (fwscanf); -__LDBL_REDIR_DECL (wscanf); -__LDBL_REDIR_DECL (swscanf); +__LDBL_REDIR_DECL (fwscanf) +__LDBL_REDIR_DECL (wscanf) +__LDBL_REDIR_DECL (swscanf) # endif __END_NAMESPACE_C99 #endif #ifdef __USE_ISOC99 __BEGIN_NAMESPACE_C99 -__LDBL_REDIR1_DECL (wcstold, wcstod); +__LDBL_REDIR1_DECL (wcstold, wcstod) # if !defined __USE_GNU && !defined __REDIRECT \ && (defined __STRICT_ANSI__ || defined __USE_XOPEN2K) __LDBL_REDIR1_DECL (vfwscanf, __nldbl___isoc99_vfwscanf) __LDBL_REDIR1_DECL (vwscanf, __nldbl___isoc99_vwscanf) __LDBL_REDIR1_DECL (vswscanf, __nldbl___isoc99_vswscanf) # else -__LDBL_REDIR_DECL (vfwscanf); -__LDBL_REDIR_DECL (vwscanf); -__LDBL_REDIR_DECL (vswscanf); +__LDBL_REDIR_DECL (vfwscanf) +__LDBL_REDIR_DECL (vwscanf) +__LDBL_REDIR_DECL (vswscanf) # endif __END_NAMESPACE_C99 #endif #ifdef __USE_GNU -__LDBL_REDIR1_DECL (wcstold_l, wcstod_l); +__LDBL_REDIR1_DECL (wcstold_l, wcstod_l) #endif #if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function Index: glibc/bits/wchar.h =================================================================== --- glibc.orig/bits/wchar.h +++ glibc/bits/wchar.h @@ -32,6 +32,8 @@ #ifdef __WCHAR_MAX__ # define __WCHAR_MAX __WCHAR_MAX__ +#elif defined(__DECC) +# define __WCHAR_MAX 0x7fffffff #elif L'\0' - 1 > 0 # define __WCHAR_MAX (0xffffffffu + L'\0') #else @@ -40,6 +42,8 @@ #ifdef __WCHAR_MIN__ # define __WCHAR_MIN __WCHAR_MIN__ +#elif defined(__DECC) +# define __WCHAR_MAX (-__WCHAR_MAX - 1) #elif L'\0' - 1 > 0 # define __WCHAR_MIN (L'\0' + 0) #else Index: glibc/sysdeps/unix/sysv/linux/alpha/bits/pthreadtypes.h =================================================================== --- glibc.orig/sysdeps/unix/sysv/linux/alpha/bits/pthreadtypes.h +++ glibc/sysdeps/unix/sysv/linux/alpha/bits/pthreadtypes.h @@ -38,7 +38,7 @@ typedef unsigned long int pthread_t; union pthread_attr_t { char __size[__SIZEOF_PTHREAD_ATTR_T]; - long int __align; + long int __align_; }; #ifndef __have_pthread_attr_t typedef union pthread_attr_t pthread_attr_t; @@ -70,7 +70,7 @@ typedef union #define __PTHREAD_MUTEX_HAVE_PREV 1 } __data; char __size[__SIZEOF_PTHREAD_MUTEX_T]; - long int __align; + long int __align_; } pthread_mutex_t; /* Mutex __spins initializer used by PTHREAD_MUTEX_INITIALIZER. */ @@ -79,7 +79,7 @@ typedef union typedef union { char __size[__SIZEOF_PTHREAD_MUTEXATTR_T]; - int __align; + int __align_; } pthread_mutexattr_t; @@ -99,13 +99,13 @@ typedef union unsigned int __broadcast_seq; } __data; char __size[__SIZEOF_PTHREAD_COND_T]; - __extension__ long long int __align; + __extension__ long long int __align_; } pthread_cond_t; typedef union { char __size[__SIZEOF_PTHREAD_CONDATTR_T]; - int __align; + int __align_; } pthread_condattr_t; @@ -139,7 +139,7 @@ typedef union unsigned int __flags; } __data; char __size[__SIZEOF_PTHREAD_RWLOCK_T]; - long int __align; + long int __align_; } pthread_rwlock_t; #define __PTHREAD_RWLOCK_ELISION_EXTRA 0 @@ -147,7 +147,7 @@ typedef union typedef union { char __size[__SIZEOF_PTHREAD_RWLOCKATTR_T]; - long int __align; + long int __align_; } pthread_rwlockattr_t; #endif @@ -161,13 +161,13 @@ typedef volatile int pthread_spinlock_t; typedef union { char __size[__SIZEOF_PTHREAD_BARRIER_T]; - long int __align; + long int __align_; } pthread_barrier_t; typedef union { char __size[__SIZEOF_PTHREAD_BARRIERATTR_T]; - int __align; + int __align_; } pthread_barrierattr_t; #endif Index: glibc/sysdeps/unix/sysv/linux/alpha/bits/semaphore.h =================================================================== --- glibc.orig/sysdeps/unix/sysv/linux/alpha/bits/semaphore.h +++ glibc/sysdeps/unix/sysv/linux/alpha/bits/semaphore.h @@ -29,5 +29,5 @@ typedef union { char __size[__SIZEOF_SEM_T]; - long int __align; + long int __align_; } sem_t; Index: glibc/inet/netinet/in.h =================================================================== --- glibc.orig/inet/netinet/in.h +++ glibc/inet/netinet/in.h @@ -567,7 +567,7 @@ extern int inet6_option_find (const stru /* Hop-by-Hop and Destination Options Processing (RFC 3542). */ extern int inet6_opt_init (void *__extbuf, socklen_t __extlen) __THROW; extern int inet6_opt_append (void *__extbuf, socklen_t __extlen, int __offset, - uint8_t __type, socklen_t __len, uint8_t __align, + uint8_t __type, socklen_t __len, uint8_t __align_, void **__databufp) __THROW; extern int inet6_opt_finish (void *__extbuf, socklen_t __extlen, int __offset) __THROW;