Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/videolan/dav1d.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHenrik Gramner <gramner@twoorioles.com>2021-06-20 19:42:21 +0300
committerHenrik Gramner <henrik@gramner.com>2021-06-20 20:02:56 +0300
commita336f470edde80bb2252b99b2d1cbd7cd40f17d0 (patch)
tree738ffe9e8d9f319d490fcbcf41d2f55c16b41d0f /include
parentf951165ea6530c1bb589064709fe7ae7b7e9eb72 (diff)
Use the 'noclone` function attribute in addition to 'noinline`
We use the 'noinline' attribute in order to reduce code size, but that doesn't prevent gcc from cloning the function, which is something that goes against the purpose of preventing inlining in the first place. Adding the 'noclone' attribute reduces the (stripped) binary size by around 45 kB on x86-64.
Diffstat (limited to 'include')
-rw-r--r--include/common/attributes.h18
1 files changed, 12 insertions, 6 deletions
diff --git a/include/common/attributes.h b/include/common/attributes.h
index 15892b9..64df445 100644
--- a/include/common/attributes.h
+++ b/include/common/attributes.h
@@ -33,6 +33,14 @@
#include <stddef.h>
#include <assert.h>
+#ifndef __has_attribute
+#define __has_attribute(x) 0
+#endif
+
+#ifndef __has_feature
+#define __has_feature(x) 0
+#endif
+
#ifdef __GNUC__
#define ATTR_ALIAS __attribute__((may_alias))
#define ATTR_FORMAT_PRINTF(fmt, attr) __attribute__((__format__(__printf__, fmt, attr)))
@@ -93,9 +101,11 @@
*/
#ifdef _MSC_VER
#define NOINLINE __declspec(noinline)
-#else /* !_MSC_VER */
+#elif __has_attribute(noclone)
+#define NOINLINE __attribute__((noinline, noclone))
+#else
#define NOINLINE __attribute__((noinline))
-#endif /* !_MSC_VER */
+#endif
#ifdef __clang__
#define NO_SANITIZE(x) __attribute__((no_sanitize(x)))
@@ -160,10 +170,6 @@ static inline int clzll(const unsigned long long mask) {
}
#endif /* !_MSC_VER */
-#ifndef __has_feature
-#define __has_feature(x) 0
-#endif
-
#ifndef static_assert
#define CHECK_OFFSET(type, field, name) \
struct check_##type##_##field { int x[(name == offsetof(type, field)) ? 1 : -1]; }