aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2020-04-04 16:56:57 -0700
committerPaul Eggert2020-04-04 16:57:43 -0700
commit15853707c8c36aff1d3cc19205971b88e04d007b (patch)
tree500707c66fb48e90d4a10fbfc4a30efef77a91be /src
parentf71afd600aef77d3c7248ae0e94b8c55fb2c5eb2 (diff)
downloademacs-15853707c8c36aff1d3cc19205971b88e04d007b.tar.gz
emacs-15853707c8c36aff1d3cc19205971b88e04d007b.zip
Default gcc -Og to inlining key ops
Problem reported by Martin Rudalics in: https://lists.gnu.org/r/emacs-devel/2020-04/msg00195.html * configure.ac (DEFINE_KEY_OPS_AS_MACROS): Define if -Og. * src/Makefile.in (KEY_OPS_CFLAGS): New macro. (EMACS_CFLAGS): Use it. * src/lisp.h (DEFINE_KEY_OPS_AS_MACROS): Let the gcc command line specify it. Remove use of undocumented INLINING macro.
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.in7
-rw-r--r--src/lisp.h22
2 files changed, 18 insertions, 11 deletions
diff --git a/src/Makefile.in b/src/Makefile.in
index 552dd2e50ae..dfd322553b8 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -377,11 +377,14 @@ endif
377# Flags that might be in WARN_CFLAGS but are not valid for Objective C. 377# Flags that might be in WARN_CFLAGS but are not valid for Objective C.
378NON_OBJC_CFLAGS = -Wignored-attributes -Wignored-qualifiers -Wopenmp-simd 378NON_OBJC_CFLAGS = -Wignored-attributes -Wignored-qualifiers -Wopenmp-simd
379 379
380# Cajole GCC into inlining key ops even if it wouldn't normally.
381KEY_OPS_CFLAGS = $(if $(filter -Og,$(CFLAGS)),-DDEFINE_KEY_OPS_AS_MACROS)
382
380# -Demacs makes some files produce the correct version for use in Emacs. 383# -Demacs makes some files produce the correct version for use in Emacs.
381# MYCPPFLAGS is for by-hand Emacs-specific overrides, e.g., 384# MYCPPFLAGS is for by-hand Emacs-specific overrides, e.g.,
382# "make MYCPPFLAGS='-DDBUS_DEBUG'". 385# "make MYCPPFLAGS='-DDBUS_DEBUG'".
383EMACS_CFLAGS=-Demacs $(MYCPPFLAGS) -I. -I$(srcdir) \ 386EMACS_CFLAGS = -Demacs $(KEY_OPS_CFLAGS) $(MYCPPFLAGS) \
384 -I$(lib) -I$(top_srcdir)/lib \ 387 -I. -I$(srcdir) -I$(lib) -I$(top_srcdir)/lib \
385 $(C_SWITCH_MACHINE) $(C_SWITCH_SYSTEM) $(C_SWITCH_X_SITE) \ 388 $(C_SWITCH_MACHINE) $(C_SWITCH_SYSTEM) $(C_SWITCH_X_SITE) \
386 $(GNUSTEP_CFLAGS) $(CFLAGS_SOUND) $(RSVG_CFLAGS) $(IMAGEMAGICK_CFLAGS) \ 389 $(GNUSTEP_CFLAGS) $(CFLAGS_SOUND) $(RSVG_CFLAGS) $(IMAGEMAGICK_CFLAGS) \
387 $(PNG_CFLAGS) $(LIBXML2_CFLAGS) $(DBUS_CFLAGS) \ 390 $(PNG_CFLAGS) $(LIBXML2_CFLAGS) $(DBUS_CFLAGS) \
diff --git a/src/lisp.h b/src/lisp.h
index f223814d8f3..7fc3af992e0 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -411,15 +411,19 @@ typedef EMACS_INT Lisp_Word;
411# define lisp_h_XTYPE(a) ((enum Lisp_Type) (XLI (a) & ~VALMASK)) 411# define lisp_h_XTYPE(a) ((enum Lisp_Type) (XLI (a) & ~VALMASK))
412#endif 412#endif
413 413
414/* When compiling via gcc -O0, define the key operations as macros, as 414/* When DEFINE_KEY_OPS_AS_MACROS, define key operations as macros to
415 Emacs is too slow otherwise. To disable this optimization, compile 415 cajole the compiler into inlining them; otherwise define them as
416 with -DINLINING=false. */ 416 inline functions as this is cleaner and can be more efficient.
417#if (defined __NO_INLINE__ \ 417 The default is true if the compiler is GCC-like and if function
418 && ! defined __OPTIMIZE__ && ! defined __OPTIMIZE_SIZE__ \ 418 inlining is disabled because the compiler is not optimizing or is
419 && ! (defined INLINING && ! INLINING)) 419 optimizing for size. Otherwise the default is false. */
420# define DEFINE_KEY_OPS_AS_MACROS true 420#ifndef DEFINE_KEY_OPS_AS_MACROS
421#else 421# if (defined __NO_INLINE__ \
422# define DEFINE_KEY_OPS_AS_MACROS false 422 && ! defined __OPTIMIZE__ && ! defined __OPTIMIZE_SIZE__)
423# define DEFINE_KEY_OPS_AS_MACROS true
424# else
425# define DEFINE_KEY_OPS_AS_MACROS false
426# endif
423#endif 427#endif
424 428
425#if DEFINE_KEY_OPS_AS_MACROS 429#if DEFINE_KEY_OPS_AS_MACROS