From 10096fc9559e8bd6128cd1d18624f9f3890609cf Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Tue, 11 Aug 2020 18:36:25 +0200 Subject: [PATCH] Use expression statements also on clang. * lib/cdefs.h (__extension__): Don't define to empty on clang. * lib/obstack.h (__extension__): Likewise. (obstack_object_size, obstack_room, obstack_make_room, obstack_empty_p, obstack_grow, obstack_grow0, obstack_1grow, obstack_ptr_grow, obstack_int_grow, obstack_ptr_grow_fast, obstack_int_grow_fast, obstack_blank, obstack_alloc, obstack_copy, obstack_copy0, obstack_finish, obstack_free): Enable as optimized macros also on clang. * lib/fpucw.h (fpucw_t etc.): Enable the definitions also on clang. --- ChangeLog | 12 ++++++++++++ lib/cdefs.h | 2 +- lib/fpucw.h | 4 ++-- lib/obstack.h | 5 +++-- 4 files changed, 18 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3465570c19..460e6f1663 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2020-08-11 Bruno Haible + + Use expression statements also on clang. + * lib/cdefs.h (__extension__): Don't define to empty on clang. + * lib/obstack.h (__extension__): Likewise. + (obstack_object_size, obstack_room, obstack_make_room, obstack_empty_p, + obstack_grow, obstack_grow0, obstack_1grow, obstack_ptr_grow, + obstack_int_grow, obstack_ptr_grow_fast, obstack_int_grow_fast, + obstack_blank, obstack_alloc, obstack_copy, obstack_copy0, + obstack_finish, obstack_free): Enable as optimized macros also on clang. + * lib/fpucw.h (fpucw_t etc.): Enable the definitions also on clang. + 2020-08-10 Bruno Haible Use many __attribute__s with clang. diff --git a/lib/cdefs.h b/lib/cdefs.h index 170d9e6340..00652549d7 100644 --- a/lib/cdefs.h +++ b/lib/cdefs.h @@ -395,7 +395,7 @@ run in pedantic mode if the uses are carefully marked using the `__extension__' keyword. But this is not generally available before version 2.8. */ -#if !__GNUC_PREREQ (2,8) +#if !(__GNUC_PREREQ (2,8) || defined __clang__) # define __extension__ /* Ignore */ #endif diff --git a/lib/fpucw.h b/lib/fpucw.h index 1c6edf6b76..8ef5420223 100644 --- a/lib/fpucw.h +++ b/lib/fpucw.h @@ -61,8 +61,8 @@ 'long double' safe operation precision */ -/* Inline assembler like this works only with GNU C. */ -#if (defined __i386__ || defined __x86_64__) && defined __GNUC__ +/* Inline assembler like this works only with GNU C and clang. */ +#if (defined __i386__ || defined __x86_64__) && (defined __GNUC__ || defined __clang__) typedef unsigned short fpucw_t; /* glibc calls this fpu_control_t */ diff --git a/lib/obstack.h b/lib/obstack.h index 987bd3b12c..9452408650 100644 --- a/lib/obstack.h +++ b/lib/obstack.h @@ -283,8 +283,9 @@ extern int obstack_exit_failure; #define obstack_memory_used(h) _obstack_memory_used (h) -#if defined __GNUC__ -# if !defined __GNUC_MINOR__ || __GNUC__ * 1000 + __GNUC_MINOR__ < 2008 +#if defined __GNUC__ || defined __clang__ +# if !(defined __GNUC_MINOR__ && __GNUC__ * 1000 + __GNUC_MINOR__ >= 2008 \ + || defined __clang__) # define __extension__ # endif -- 2.39.5