GNU bug report logs - #11935
XINT etc. should be functions

Previous Next

Package: emacs;

Reported by: Paul Eggert <eggert <at> cs.ucla.edu>

Date: Fri, 13 Jul 2012 15:15:02 UTC

Severity: wishlist

Tags: patch

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: rms <at> gnu.org
Cc: 11935 <at> debbugs.gnu.org
Subject: bug#11935: XINT etc. should be functions
Date: Mon, 16 Jul 2012 15:46:31 -0700
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 <at> 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





This bug report was last modified 5 years and 119 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.