bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#11935: XINT etc. should be functions


From: Paul Eggert
Subject: bug#11935: XINT etc. should be functions
Date: Mon, 16 Jul 2012 15:46:31 -0700
User-agent: Mozilla/5.0 (X11; Linux i686; rv:13.0) Gecko/20120615 Thunderbird/13.0.1

On 07/16/2012 11:19 AM, Richard Stallman wrote:

> Please set them up to always inline.  There can be
> a macro switch to turn that off with -D.

Sure, that's easy.  I plan to incorporate something like the patch
below, which uses -DINLINING=0 to turn it off (default is INLINING=1).

=== modified file 'ChangeLog'
--- ChangeLog   2012-07-16 06:49:45 +0000
+++ ChangeLog   2012-07-16 22:35:32 +0000
@@ -3,6 +3,9 @@
        Use functions, not macros, for XINT etc.
        * configure.ac (WARN_CFLAGS): Remove -Wbad-function-cast,
        as it generates bogus warnings about reasonable casts of calls.
+       (ALWAYS_INLINE): New macro.
+       (inline): Define to 'ALWAYS_INLINE' when compiling with GCC without
+       optimization, and without -DINLINING=0.
 
 2012-07-15  Paul Eggert  <eggert@cs.ucla.edu>
 

=== modified file 'configure.ac'
--- configure.ac        2012-07-15 00:33:12 +0000
+++ configure.ac        2012-07-16 22:21:37 +0000
@@ -4238,6 +4238,25 @@
 #include <string.h>
 #include <stdlib.h>
 
+#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 2)
+# define ALWAYS_INLINE __attribute__ ((__always_inline__))
+#else
+# define ALWAYS_INLINE
+#endif
+
+/* When compiling via GCC without optimization, and without -DINLINING=0,
+   always inline functions marked 'inline'.  This typically improves CPU
+   performance when debugging.  With optimization, trust the compiler
+   to inline as appropriate.  */
+#ifndef INLINING
+# define INLINING 1
+#endif
+#if (defined __NO_INLINE__ \
+     && ! defined __OPTIMIZE__ && ! defined __OPTIMIZE_SIZE__ \
+     && INLINING && !defined inline)
+# define inline ALWAYS_INLINE
+#endif
+
 #if __GNUC__ >= 3  /* On GCC 3.0 we might get a warning.  */
 #define NO_INLINE __attribute__((noinline))
 #else






reply via email to

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