diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2017-07-28 15:28:33 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2017-07-28 15:28:33 +0200 |
commit | 619d9b5e6848a72350126ea9c1e413fd133181e3 (patch) | |
tree | 1fe4ab734bd3b917ec4e9ef35d2c1e700a850605 /include/platform.h | |
parent | 46f3f16b587ce781ab43a7b17698e1e565b2acf7 (diff) | |
download | busybox-w32-619d9b5e6848a72350126ea9c1e413fd133181e3.tar.gz busybox-w32-619d9b5e6848a72350126ea9c1e413fd133181e3.tar.bz2 busybox-w32-619d9b5e6848a72350126ea9c1e413fd133181e3.zip |
ash: less hackish implementation of evaltreenr()
Defining a function alias with __attribute__ ((alias("evaltree"),__noreturn__))
is not that usual, and clang had a bug which made it misunderstand
this construct.
Switch to:
ALWAYS_INLINE NORETURN evaltreenr() { evaltree(); unreachable(); }
Older gcc's do not know unreachable(), on them we pay the price of having
a few extra calls to abort():
function old new delta
evalsubshell 151 156 +5
evalpipe 357 362 +5
argstr 1141 1144 +3
On newer gcc, code size does not change.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'include/platform.h')
-rw-r--r-- | include/platform.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/include/platform.h b/include/platform.h index 8210e5c49..ea49c7e92 100644 --- a/include/platform.h +++ b/include/platform.h | |||
@@ -45,6 +45,13 @@ | |||
45 | 45 | ||
46 | #define UNUSED_PARAM __attribute__ ((__unused__)) | 46 | #define UNUSED_PARAM __attribute__ ((__unused__)) |
47 | #define NORETURN __attribute__ ((__noreturn__)) | 47 | #define NORETURN __attribute__ ((__noreturn__)) |
48 | |||
49 | #if __GNUC_PREREQ(4,5) | ||
50 | # define bb_unreachable(altcode) __builtin_unreachable() | ||
51 | #else | ||
52 | # define bb_unreachable(altcode) altcode | ||
53 | #endif | ||
54 | |||
48 | /* "The malloc attribute is used to tell the compiler that a function | 55 | /* "The malloc attribute is used to tell the compiler that a function |
49 | * may be treated as if any non-NULL pointer it returns cannot alias | 56 | * may be treated as if any non-NULL pointer it returns cannot alias |
50 | * any other pointer valid when the function returns. This will often | 57 | * any other pointer valid when the function returns. This will often |