diff --git a/.pick_status.json b/.pick_status.json index eca329520c8..dfab34b9f9d 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -404,7 +404,7 @@ "description": "util: Add ATTRIBUTE_OPTIMIZE(flags)", "nominated": false, "nomination_type": 3, - "resolution": 4, + "resolution": 1, "main_sha": null, "because_sha": null, "notes": null diff --git a/meson.build b/meson.build index 09bb1f31d8b..60c8723da7b 100644 --- a/meson.build +++ b/meson.build @@ -1013,6 +1013,7 @@ endforeach _attributes = [ 'const', 'flatten', 'malloc', 'pure', 'unused', 'warn_unused_result', 'weak', 'format', 'packed', 'returns_nonnull', 'alias', 'noreturn', + 'optimize', ] foreach a : cc.get_supported_function_attributes(_attributes) pre_args += '-DHAVE_FUNC_ATTRIBUTE_@0@'.format(a.to_upper()) diff --git a/src/util/macros.h b/src/util/macros.h index dac3872e781..88b30299d85 100644 --- a/src/util/macros.h +++ b/src/util/macros.h @@ -240,6 +240,12 @@ do { \ # endif #endif +#ifdef HAVE_FUNC_ATTRIBUTE_OPTIMIZE +#define ATTRIBUTE_OPTIMIZE(flags) __attribute__((__optimize__((flags)))) +#else +#define ATTRIBUTE_OPTIMIZE(flags) +#endif + #ifdef __cplusplus /** * Macro function that evaluates to true if T is a trivially