summaryrefslogtreecommitdiff
path: root/src/lisp.h
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2013-07-10 16:23:57 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2013-07-10 16:23:57 -0700
commit29abe551a0d9137718cd21732c9dc383d6493d71 (patch)
tree9730894ac27692871e3c7cba38fcb4df6412d8bc /src/lisp.h
parent3d70c5cfa9aae030c5ab8e8e612319a6645cf659 (diff)
downloademacs-29abe551a0d9137718cd21732c9dc383d6493d71.tar.gz
emacs-29abe551a0d9137718cd21732c9dc383d6493d71.tar.bz2
emacs-29abe551a0d9137718cd21732c9dc383d6493d71.zip
Port to C89.
* lib-src/ebrowse.c (USAGE): Remove macro with too-long string literal ... (usage_message): ... and replace it with this new static constant containing multiple literals. All uses changed. * lib-src/emacsclient.c (print_help_and_exit): Rewrite to avoid string literals longer than the C89 limits. (start_daemon_and_retry_set_socket): Rewrite to avoid non-constant array initializer. * lib-src/make-docfile.c (enum global_type): Omit trailing comma. * src/bytecode.c (BYTE_CODE_THREADED): Do not define if __STRICT_ANSI__. (B__dummy__): New dummy symbol, to pacify C89. * src/dbusbind.c (XD_DEBUG_MESSAGE): Omit debugging on C89 hosts, since they can't grok varargs macros. * src/dispnew.c (add_window_display_history) (add_frame_display_history): * src/print.c (print_object): * src/xdisp.c (debug_method_add): Use %p printf format only for void pointers. * src/emacs.c (usage_message): New constant, replacing ... (USAGE1, USAGE2, USAGE3): Remove; they were too long for C89. (main): Adjust to usage reorg. * src/fns.c (syms_of_fns): * src/profiler.c (syms_of_profiler): Don't use non-constant struct initializers. * src/gnutls.h (gnutls_initstage_t): * src/lisp.h (enum Lisp_Fwd_Type): * src/lread.c (lisp_file_lexically_bound_p): * src/xsettings.c (anonymous enum): Remove trailing comma. * src/xsettings.c (apply_xft_settings): Use %f, not %lf; %lf is a C99ism. * src/lisp.h (ENUM_BF): Use unsigned if pedantic. (DEFUN_FUNCTION_INIT): New macro, that falls back on a cast if pre-C99. (DEFUN): Use it. * src/regex.c (const_re_char): New type, to pacify strict C89. All uses of 'const re_char' replaced to use it. * src/regex.h (_Restrict_): Rename from __restrict, to avoid clash with glibc when strict C89. This change is imported from gnulib. All uses changed. (_Restrict_arr_): Rename from __restrict_arr, similarly. * src/sysdep.c (time_from_jiffies) [!HAVE_LONG_LONG_INT]: Omit GNU_LINUX implementation, since it requires long long. * src/xterm.c (x_draw_underwave): Do not assume the traditional order of struct's members. (x_term_init): Rewrite to avoid the need for non-constant structure initializers.
Diffstat (limited to 'src/lisp.h')
-rw-r--r--src/lisp.h17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/lisp.h b/src/lisp.h
index 33e9309de34..4af256f54b6 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -363,9 +363,9 @@ enum enum_USE_LSB_TAG { USE_LSB_TAG = 0 };
#define INTMASK (EMACS_INT_MAX >> (INTTYPEBITS - 1))
#define case_Lisp_Int case Lisp_Int0: case Lisp_Int1
-/* Idea stolen from GDB. MSVC doesn't support enums in bitfields,
- and xlc complains vociferously about them. */
-#if defined _MSC_VER || defined __IBMC__
+/* Idea stolen from GDB. Pedantic GCC complains about enum bitfields,
+ MSVC doesn't support them, and xlc complains vociferously about them. */
+#if defined __STRICT_ANSI__ || defined _MSC_VER || defined __IBMC__
#define ENUM_BF(TYPE) unsigned int
#else
#define ENUM_BF(TYPE) enum TYPE
@@ -398,7 +398,7 @@ enum Lisp_Type
/* Cons. XCONS (object) points to a struct Lisp_Cons. */
Lisp_Cons = 6,
- Lisp_Float = 7,
+ Lisp_Float = 7
};
/* This is the set of data types that share a common structure.
@@ -428,7 +428,7 @@ enum Lisp_Fwd_Type
Lisp_Fwd_Bool, /* Fwd to a C boolean var. */
Lisp_Fwd_Obj, /* Fwd to a C Lisp_Object variable. */
Lisp_Fwd_Buffer_Obj, /* Fwd to a Lisp_Object field of buffers. */
- Lisp_Fwd_Kboard_Obj, /* Fwd to a Lisp_Object field of kboards. */
+ Lisp_Fwd_Kboard_Obj /* Fwd to a Lisp_Object field of kboards. */
};
/* If you want to define a new Lisp data type, here are some
@@ -2540,11 +2540,16 @@ CHECK_NUMBER_CDR (Lisp_Object x)
minargs, maxargs, lname, intspec, 0}; \
Lisp_Object fnname
#else /* not _MSC_VER */
+# if __STDC_VERSION__ < 199901
+# define DEFUN_FUNCTION_INIT(fnname, maxargs) (Lisp_Object (*) (void)) fnname
+# else
+# define DEFUN_FUNCTION_INIT(fnname, maxargs) .a ## maxargs = fnname
+# endif
#define DEFUN(lname, fnname, sname, minargs, maxargs, intspec, doc) \
Lisp_Object fnname DEFUN_ARGS_ ## maxargs ; \
static struct Lisp_Subr alignas (GCALIGNMENT) sname = \
{ { PVEC_SUBR << PSEUDOVECTOR_AREA_BITS }, \
- { .a ## maxargs = fnname }, \
+ { DEFUN_FUNCTION_INIT (fnname, maxargs) }, \
minargs, maxargs, lname, intspec, 0}; \
Lisp_Object fnname
#endif