From 869cb2ad5f52a556dde0e88bf0ccc09985883003 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sun, 16 Aug 2020 18:57:22 +0200 Subject: [PATCH] Use 'throw ()' for optimization in C++ mode also on clang. * lib/cdefs.h (__THROW): Define to 'throw ()' also on clang. * lib/getopt-cdefs.in.h (__THROW): Likewise. * lib/md5.h (__THROW): Likewise. --- ChangeLog | 7 +++++++ lib/cdefs.h | 2 +- lib/getopt-cdefs.in.h | 2 +- lib/md5.h | 2 +- 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index c5f7fc5421..3182814f43 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2020-08-16 Bruno Haible + + Use 'throw ()' for optimization in C++ mode also on clang. + * lib/cdefs.h (__THROW): Define to 'throw ()' also on clang. + * lib/getopt-cdefs.in.h (__THROW): Likewise. + * lib/md5.h (__THROW): Likewise. + 2020-08-16 Bruno Haible absolute-header: Add support for clang. diff --git a/lib/cdefs.h b/lib/cdefs.h index dfa935fc8d..b7f60c1842 100644 --- a/lib/cdefs.h +++ b/lib/cdefs.h @@ -85,7 +85,7 @@ # define __NTH(fct) __attribute__ ((__nothrow__ __LEAF)) fct # define __NTHNL(fct) __attribute__ ((__nothrow__)) fct # else -# if defined __cplusplus && __GNUC_PREREQ (2,8) +# if defined __cplusplus && (__GNUC_PREREQ (2,8) || __clang_major >= 4) # define __THROW throw () # define __THROWNL throw () # define __NTH(fct) __LEAF_ATTR fct throw () diff --git a/lib/getopt-cdefs.in.h b/lib/getopt-cdefs.in.h index 89a7b85edb..641e5e9a0c 100644 --- a/lib/getopt-cdefs.in.h +++ b/lib/getopt-cdefs.in.h @@ -57,7 +57,7 @@ #endif #ifndef __THROW -# if defined __cplusplus && __GNUC_PREREQ (2,8) +# if defined __cplusplus && (__GNUC_PREREQ (2,8) || __clang_major__ >= 4) # define __THROW throw () # else # define __THROW diff --git a/lib/md5.h b/lib/md5.h index 0c8b929745..46310351c8 100644 --- a/lib/md5.h +++ b/lib/md5.h @@ -40,7 +40,7 @@ #endif #ifndef __THROW -# if defined __cplusplus && __GNUC_PREREQ (2,8) +# if defined __cplusplus && (__GNUC_PREREQ (2,8) || __clang_major__ >= 4) # define __THROW throw () # else # define __THROW -- 2.39.5