From 9b0e8a4c6b540dcb962607763846040942858c5a Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 3 Apr 2018 17:30:48 -0700 Subject: [PATCH] Pacify GCC when --enable-profiling * src/conf_post.h (PROFILING): Undef if not on a platform that supports it. Simplify uses accordingly. * src/emacs.c (etext) [PROFILING]: Declare at top level to avoid GCC warning. --- src/conf_post.h | 4 ++++ src/dispnew.c | 4 +--- src/emacs.c | 16 ++++++---------- src/lisp.h | 3 +-- 4 files changed, 12 insertions(+), 15 deletions(-) diff --git a/src/conf_post.h b/src/conf_post.h index 69f686d72df..00e283d289c 100644 --- a/src/conf_post.h +++ b/src/conf_post.h @@ -344,6 +344,10 @@ extern int emacs_setenv_TZ (char const *); # 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 diff --git a/src/dispnew.c b/src/dispnew.c index 56f125218dc..324c05ddc4c 100644 --- a/src/dispnew.c +++ b/src/dispnew.c @@ -234,9 +234,7 @@ DEFUN ("dump-redisplay-history", Fdump_redisplay_history, #endif /* GLYPH_DEBUG */ -#if (defined PROFILING \ - && (defined __FreeBSD__ || defined GNU_LINUX || defined __MINGW32__) \ - && !HAVE___EXECUTABLE_START) +#if defined PROFILING && !HAVE___EXECUTABLE_START /* This function comes first in the Emacs executable and is used only to estimate the text start for profiling. */ void diff --git a/src/emacs.c b/src/emacs.c index 8ea61b71fb7..f25e6126642 100644 --- a/src/emacs.c +++ b/src/emacs.c @@ -94,10 +94,14 @@ along with GNU Emacs. If not, see . */ #include "getpagesize.h" #include "gnutls.h" -#if (defined PROFILING \ - && (defined __FreeBSD__ || defined GNU_LINUX || defined __MINGW32__)) +#ifdef PROFILING # include extern void moncontrol (int mode); +# ifdef __MINGW32__ +extern unsigned char etext asm ("etext"); +# else +extern char etext; +# endif #endif #ifdef HAVE_SETLOCALE @@ -1700,22 +1704,14 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem GNU/Linux and MinGW. It might work on some other systems too. Give it a try and tell us if it works on your system. To compile for profiling, use the configure option --enable-profiling. */ -#if defined (__FreeBSD__) || defined (GNU_LINUX) || defined (__MINGW32__) #ifdef PROFILING if (initialized) { -#ifdef __MINGW32__ - extern unsigned char etext asm ("etext"); -#else - extern char etext; -#endif - atexit (_mcleanup); monstartup ((uintptr_t) __executable_start, (uintptr_t) &etext); } else moncontrol (0); -#endif #endif initialized = 1; diff --git a/src/lisp.h b/src/lisp.h index c931d9c8f05..a18b64a588f 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -3596,8 +3596,7 @@ extern void replace_range_2 (ptrdiff_t, ptrdiff_t, ptrdiff_t, ptrdiff_t, extern void syms_of_insdel (void); /* Defined in dispnew.c. */ -#if (defined PROFILING \ - && (defined __FreeBSD__ || defined GNU_LINUX || defined __MINGW32__)) +#ifdef PROFILING _Noreturn void __executable_start (void); #endif extern Lisp_Object Vwindow_system; -- 2.39.2