Bug 1907001 - Add MOZ_HAS_CLANG_ATTRIBUTE r=glandium

Note this patch was provided by a contributor to fix MSVC builds of a SpiderMonkey embedding.

Differential Revision: https://phabricator.services.mozilla.com/D216843
This commit is contained in:
fanc999 2024-07-25 15:17:24 +00:00
Родитель 77de6a9c73
Коммит 29c55a7924
1 изменённых файлов: 10 добавлений и 5 удалений

Просмотреть файл

@ -78,6 +78,13 @@
# define MOZ_HAVE_NO_STACK_PROTECTOR __attribute__((no_stack_protector))
#endif
/* if defined(__clang__) && __has_attribute (attr) may not be portable */
#if defined(__clang__)
# define MOZ_HAS_CLANG_ATTRIBUTE(attr) __has_attribute(attr)
#else
# define MOZ_HAS_CLANG_ATTRIBUTE(attr) 0
#endif
/*
* When built with clang analyzer (a.k.a scan-build), define MOZ_HAVE_NORETURN
* to mark some false positives
@ -88,15 +95,13 @@
# endif
#endif
#if defined(__GNUC__) || \
(defined(__clang__) && __has_attribute(no_profile_instrument_function))
#if defined(__GNUC__) || MOZ_HAS_CLANG_ATTRIBUTE(no_profile_instrument_function)
# define MOZ_NOPROFILE __attribute__((no_profile_instrument_function))
#else
# define MOZ_NOPROFILE
#endif
#if defined(__GNUC__) || \
(defined(__clang__) && __has_attribute(no_instrument_function))
#if defined(__GNUC__) || (MOZ_HAS_CLANG_ATTRIBUTE(no_instrument_function))
# define MOZ_NOINSTRUMENT __attribute__((no_instrument_function))
#else
# define MOZ_NOINSTRUMENT
@ -121,7 +126,7 @@
*
* This is useful to have clearer information on assertion failures.
*/
#if defined(__clang__) && __has_attribute(nomerge)
#if MOZ_HAS_CLANG_ATTRIBUTE(nomerge)
# define MOZ_NOMERGE __attribute__((nomerge))
#else
# define MOZ_NOMERGE