emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 9b0e8a4: Pacify GCC when --enable-profiling


From: Paul Eggert
Subject: [Emacs-diffs] master 9b0e8a4: Pacify GCC when --enable-profiling
Date: Tue, 3 Apr 2018 20:32:22 -0400 (EDT)

branch: master
commit 9b0e8a4c6b540dcb962607763846040942858c5a
Author: Paul Eggert <address@hidden>
Commit: Paul Eggert <address@hidden>

    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 69f686d..00e283d 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 56f1252..324c05d 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 8ea61b7..f25e612 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -94,10 +94,14 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
 #include "getpagesize.h"
 #include "gnutls.h"
 
-#if (defined PROFILING \
-     && (defined __FreeBSD__ || defined GNU_LINUX || defined __MINGW32__))
+#ifdef PROFILING
 # include <sys/gmon.h>
 extern void moncontrol (int mode);
+# ifdef __MINGW32__
+extern unsigned char etext asm ("etext");
+# else
+extern char etext;
+# endif
 #endif
 
 #ifdef HAVE_SETLOCALE
@@ -1700,23 +1704,15 @@ 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 c931d9c..a18b64a 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;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]