diff options
Diffstat (limited to 'src/conf_post.h')
-rw-r--r-- | src/conf_post.h | 46 |
1 files changed, 29 insertions, 17 deletions
diff --git a/src/conf_post.h b/src/conf_post.h index 3c87d87ec26..002ef6c65bc 100644 --- a/src/conf_post.h +++ b/src/conf_post.h @@ -20,9 +20,16 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */ /* Put the code here rather than in configure.ac using AH_BOTTOM. This way, the code does not get processed by autoheader. For - example, undefs here are not commented out. + example, undefs here are not commented out. */ - To help make dependencies clearer elsewhere, this file typically +/* Disable 'assert' unless enabling checking. Do this early, in + case some misguided implementation depends on NDEBUG in some + include file other than assert.h. */ +#if !defined ENABLE_CHECKING && !defined NDEBUG +# define NDEBUG +#endif + +/* To help make dependencies clearer elsewhere, this file typically does not #include other files. The exceptions are first stdbool.h because it is unlikely to interfere with configuration and bool is such a core part of the C language, and second ms-w32.h (DOS_NT @@ -69,14 +76,7 @@ typedef bool bool_bf; # define __has_attribute_externally_visible GNUC_PREREQ (4, 1, 0) # define __has_attribute_no_address_safety_analysis false # define __has_attribute_no_sanitize_address GNUC_PREREQ (4, 8, 0) -#endif - -/* Simulate __has_builtin on compilers that lack it. It is used only - on arguments like __builtin_assume_aligned that are handled in this - simulation. */ -#ifndef __has_builtin -# define __has_builtin(a) __has_builtin_##a -# define __has_builtin___builtin_assume_aligned GNUC_PREREQ (4, 7, 0) +# define __has_attribute_no_sanitize_undefined GNUC_PREREQ (4, 9, 0) #endif /* Simulate __has_feature on compilers that lack it. It is used only @@ -92,11 +92,6 @@ typedef bool bool_bf; # define ADDRESS_SANITIZER false #endif -/* Yield PTR, which must be aligned to ALIGNMENT. */ -#if ! __has_builtin (__builtin_assume_aligned) -# define __builtin_assume_aligned(ptr, ...) ((void *) (ptr)) -#endif - #ifdef DARWIN_OS #if defined emacs && !defined CANNOT_DUMP #define malloc unexec_malloc @@ -220,7 +215,7 @@ extern void _DebPrint (const char *fmt, ...); /* Tell regex.c to use a type compatible with Emacs. */ #define RE_TRANSLATE_TYPE Lisp_Object #define RE_TRANSLATE(TBL, C) char_table_translate (TBL, C) -#define RE_TRANSLATE_P(TBL) (!EQ (TBL, make_number (0))) +#define RE_TRANSLATE_P(TBL) (!EQ (TBL, make_fixnum (0))) #endif /* Tell time_rz.c to use Emacs's getter and setter for TZ. @@ -284,6 +279,7 @@ extern int emacs_setenv_TZ (char const *); #define ATTRIBUTE_FORMAT_PRINTF(string_index, first_to_check) \ ATTRIBUTE_FORMAT ((PRINTF_ARCHETYPE, string_index, first_to_check)) +#define ARG_NONNULL _GL_ARG_NONNULL #define ATTRIBUTE_CONST _GL_ATTRIBUTE_CONST #define ATTRIBUTE_UNUSED _GL_UNUSED @@ -340,12 +336,28 @@ extern int emacs_setenv_TZ (char const *); # define ATTRIBUTE_NO_SANITIZE_ADDRESS #endif -/* gcc -fsanitize=address does not work with vfork in Fedora 25 x86-64. +/* Attribute of functions whose undefined behavior should not be sanitized. */ + +#if __has_attribute (no_sanitize_undefined) +# define ATTRIBUTE_NO_SANITIZE_UNDEFINED __attribute__ ((no_sanitize_undefined)) +#elif __has_attribute (no_sanitize) +# define ATTRIBUTE_NO_SANITIZE_UNDEFINED \ + __attribute__ ((no_sanitize ("undefined"))) +#else +# define ATTRIBUTE_NO_SANITIZE_UNDEFINED +#endif + +/* gcc -fsanitize=address does not work with vfork in Fedora 28 x86-64. See: + https://lists.gnu.org/r/emacs-devel/2017-05/msg00464.html For now, assume that this problem occurs on all platforms. */ #if ADDRESS_SANITIZER && !defined vfork # define vfork fork #endif +#if ! (defined __FreeBSD__ || defined GNU_LINUX || defined __MINGW32__) +# undef PROFILING +#endif + /* Some versions of GNU/Linux define noinline in their headers. */ #ifdef noinline #undef noinline |