I've threatened to do this several times. Here's the rationale:
1) The DECLARE_DOESNT_RETURN_GCC_ATTRIBUTE_SYNTAX_SUCKS macro was
created and so named because, at the time, you couldn't have more
than 1 __attribute__ declaration per function. That was changed in
gcc 2.6.0, so there's not much point in complaining about it
anymore.
2) Defining "register" to nothing was done by Steve Baur. From my
reading of the archives, he thought that this helped generate
better code on x86 platforms with a specific (now old) gcc version.
I do not see any hard evidence in the archives that this was so.
In any case, we certainly shouldn't be defining it to nothing for
every platform and every compiler. If somebody can show concrete
evidence that use of "register" causes a specific compiler on a
specific platform to generate suboptimal code, we can deal with it
then.
3) It would be nice to have access to the __attribute__ definitions
from files in lib-src, but lisp.h in its entirety should not be
included there.
Please have a look at this patch and tell me what you think. I'll
attach the new src/compiler.h file. Tell me what you think about the
names I chose; I'm not happy with some of them but am failing to think
of anything better.
I have compiled successfully with g++ on Linux with this patch. I'll
try it on a few other platforms this weekend.
Index: lib-src/ellcc.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/lib-src/ellcc.c,v
retrieving revision 1.7
diff -d -u -u -r1.7 ellcc.c
--- lib-src/ellcc.c 2003/09/22 03:21:12 1.7
+++ lib-src/ellcc.c 2003/10/10 22:32:16
@@ -78,27 +78,7 @@
#include <emodules.h>
#include <ellcc.h> /* Generated files must be included using <...> */
-
-#ifndef ATTRIBUTE_MALLOC
-# if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__==2 &&
__GNUC_MINOR__>=96))
-# define ATTRIBUTE_MALLOC __attribute__ ((__malloc__))
-# else
-# define ATTRIBUTE_MALLOC
-# endif /* GCC version >= 2.96 */
-#endif /* ATTRIBUTE_MALLOC */
-
-#ifdef __GNUC_
-# define ATTRIBUTE_FATAL __attribute__ ((noreturn, format (printf, 1, 2)))
-#else
-# define ATTRIBUTE_FATAL
-#endif /* __GNUC__ */
-
-#if defined(__GNUC__) && (__GNUC__ >= 2 || (__GNUC__==2 &&
__GNUC_MINOR__>=5))
-# define ATTRIBUTE_CONST __attribute__ ((const))
-#else
-# define ATTRIBUTE_CONST
-#endif
-
+#include "compiler.h"
#ifndef HAVE_SHLIB
int
@@ -188,7 +168,7 @@
static void *xmalloc (size_t size) ATTRIBUTE_MALLOC;
static void *xrealloc (void *ptr, size_t size) ATTRIBUTE_MALLOC;
static char *xstrdup (char *) ATTRIBUTE_MALLOC;
-static void fatal (char *, ...) ATTRIBUTE_FATAL;
+static DECLARE_DOESNT_RETURN (fatal (char *, ...)) PRINTF_ARGS (1, 2);
static char ** add_string (char **, char *);
static char ** add_to_argv (char **, const char *);
static char ** do_compile_mode (void);
@@ -467,7 +447,7 @@
}
/* Print error message and exit. */
-static void
+static DOESNT_RETURN
fatal (char *format, ...)
{
va_list ap;
Index: src/dumper.h
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/dumper.h,v
retrieving revision 1.3
diff -d -u -u -r1.3 dumper.h
--- src/dumper.h 2003/09/16 03:57:58 1.3
+++ src/dumper.h 2003/10/10 22:32:16
@@ -23,9 +23,7 @@
#ifndef INCLUDED_dumper_h
#define INCLUDED_dumper_h
-#ifdef __cplusplus
-extern "C" {
-#endif
+BEGIN_C_DECLS
void pdump_objects_unmark (void);
void pdump (void);
@@ -34,8 +32,6 @@
extern unsigned int dump_id;
extern char *pdump_start, *pdump_end;
-#ifdef __cplusplus
-}
-#endif
+END_C_DECLS
#endif /* INCLUDED_dumper_h */
Index: src/glyphs-eimage.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/glyphs-eimage.c,v
retrieving revision 1.18
diff -d -u -u -r1.18 glyphs-eimage.c
--- src/glyphs-eimage.c 2003/09/30 15:26:48 1.18
+++ src/glyphs-eimage.c 2003/10/10 22:32:17
@@ -61,15 +61,15 @@
#include "sysfile.h"
#ifdef HAVE_PNG
-#ifdef __cplusplus
-extern "C" {
-#endif
+
+BEGIN_C_DECLS
+
#define message message_ /* Yuck */
#include <png.h>
#undef message
-#ifdef __cplusplus
-}
-#endif
+
+END_C_DECLS
+
#else
#include <setjmp.h>
#endif
@@ -102,14 +102,12 @@
* JPEG *
**********************************************************************/
-#ifdef __cplusplus
-extern "C" {
-#endif
+BEGIN_C_DECLS
+
#include <jpeglib.h>
#include <jerror.h>
-#ifdef __cplusplus
-}
-#endif
+
+END_C_DECLS
/*#define USE_TEMP_FILES_FOR_JPEG_IMAGES 1*/
static void
Index: src/glyphs-gtk.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/glyphs-gtk.c,v
retrieving revision 1.19
diff -d -u -u -r1.19 glyphs-gtk.c
--- src/glyphs-gtk.c 2003/09/30 15:26:48 1.19
+++ src/glyphs-gtk.c 2003/10/10 22:32:17
@@ -1376,13 +1376,10 @@
/* We have to define SYSV32 so that compface.h includes string.h
instead of strings.h. */
#define SYSV32
-#ifdef __cplusplus
-extern "C" {
-#endif
+BEGIN_C_DECLS
#include <compface.h>
-#ifdef __cplusplus
-}
-#endif
+END_C_DECLS
+
/* JMP_BUF cannot be used here because if it doesn't get defined
to jmp_buf we end up with a conflicting type error with the
definition in compface.h */
Index: src/glyphs-msw.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/glyphs-msw.c,v
retrieving revision 1.48
diff -d -u -u -r1.48 glyphs-msw.c
--- src/glyphs-msw.c 2003/09/30 15:26:48 1.48
+++ src/glyphs-msw.c 2003/10/10 22:32:17
@@ -1615,13 +1615,10 @@
/* We have to define SYSV32 so that compface.h includes string.h
instead of strings.h. */
#define SYSV32
-#ifdef __cplusplus
-extern "C" {
-#endif
+BEGIN_C_DECLS
#include <compface.h>
-#ifdef __cplusplus
-}
-#endif
+END_C_DECLS
+
/* JMP_BUF cannot be used here because if it doesn't get defined
to jmp_buf we end up with a conflicting type error with the
definition in compface.h */
Index: src/glyphs-x.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/glyphs-x.c,v
retrieving revision 1.76
diff -d -u -u -r1.76 glyphs-x.c
--- src/glyphs-x.c 2003/09/30 15:26:49 1.76
+++ src/glyphs-x.c 2003/10/10 22:32:17
@@ -1545,13 +1545,10 @@
/* We have to define SYSV32 so that compface.h includes string.h
instead of strings.h. */
#define SYSV32
-#ifdef __cplusplus
-extern "C" {
-#endif
+BEGIN_C_DECLS
#include <compface.h>
-#ifdef __cplusplus
-}
-#endif
+END_C_DECLS
+
/* JMP_BUF cannot be used here because if it doesn't get defined
to jmp_buf we end up with a conflicting type error with the
definition in compface.h */
Index: src/gtk-xemacs.h
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/gtk-xemacs.h,v
retrieving revision 1.2
diff -d -u -u -r1.2 gtk-xemacs.h
--- src/gtk-xemacs.h 2001/04/12 18:23:54 1.2
+++ src/gtk-xemacs.h 2003/10/10 22:32:17
@@ -15,9 +15,7 @@
#include <gdk/gdk.h>
#include <gtk/gtkfixed.h>
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
+BEGIN_C_DECLS
#define GTK_XEMACS(obj) GTK_CHECK_CAST (obj, gtk_xemacs_get_type (), GtkXEmacs)
#define GTK_XEMACS_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_xemacs_get_type (),
GtkXEmacsClass)
@@ -41,8 +39,6 @@
guint gtk_xemacs_get_type (void);
GtkWidget *gtk_xemacs_new (struct frame *f);
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
+END_C_DECLS
#endif /* __GTK_XEMACS_H__ */
Index: src/libinterface.h
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/libinterface.h,v
retrieving revision 1.1
diff -d -u -u -r1.1 libinterface.h
--- src/libinterface.h 2002/06/10 12:43:42 1.1
+++ src/libinterface.h 2003/10/10 22:32:17
@@ -28,9 +28,7 @@
#endif /* HAVE_GIF */
#ifdef HAVE_PNG
-#ifdef __cplusplus
-extern "C" {
-#endif
+BEGIN_C_DECLS
#define message message_ /* Yuck */
/* See comment in libinterface.c for the following */
#define PNG_EXPORT(type, symbol) type XCDECL symbol
@@ -38,9 +36,7 @@
#define ZEXPORTVA XCDECL
#include <png.h>
#undef message
-#ifdef __cplusplus
-}
-#endif
+END_C_DECLS
#endif /* HAVE_PNG */
/* #### WARNING: Utterly random magic here to prevent namespace conflicts
@@ -49,9 +45,7 @@
glyphs-msw.c. For some reason, putting the XPM code after this fixes
other problems; don't move it before. --ben */
#if defined (HAVE_JPEG) && !defined (DONT_NEED_JPEG)
-#ifdef __cplusplus
-extern "C" {
-#endif
+BEGIN_C_DECLS
#ifdef _MSC_VER
# ifndef XMD_H
/* Yuck! This tricks jpeglib.h into not defining INT32, which is defined
@@ -65,9 +59,7 @@
# undef XMD_H
#endif
#include <jerror.h>
-#ifdef __cplusplus
-}
-#endif
+END_C_DECLS
boolean XCDECL qxe_jpeg_finish_decompress (j_decompress_ptr cinfo);
boolean XCDECL qxe_jpeg_start_decompress (j_decompress_ptr cinfo);
Index: src/lisp.h
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/lisp.h,v
retrieving revision 1.108
diff -d -u -u -r1.108 lisp.h
--- src/lisp.h 2003/09/30 15:26:51 1.108
+++ src/lisp.h 2003/10/10 22:32:18
@@ -45,6 +45,9 @@
Various macro-related changes by Martin Buchholz, 1998-1999:
LIST_LOOP macros greatly expanded and tortoise-hared;
RETURN_SANS_WARNINGS; reworked DEFUN macros; EXFUN macros (???).
+ Various macro-related changes by Jerry James, 2003:
+ MODULE_API introduced;
+ Compiler-specific definitions modernized and moved to compiler.h.
*/
#ifndef INCLUDED_lisp_h_
@@ -815,128 +818,8 @@
#endif
/* ------------------------ basic compiler defines ------------------- */
-
-/* Also define min() and max(). (Some compilers put them in strange
- places that won't be referenced by the above include files, such
- as 'macros.h' under Solaris.) */
-
-#ifndef min
-#define min(a,b) (((a) <= (b)) ? (a) : (b))
-#endif
-#ifndef max
-#define max(a,b) (((a) > (b)) ? (a) : (b))
-#endif
-
-/* Sim, senhor, prefiro toma-lo no cu.
-
- Regular C complains about possible clobbering of local vars NOT declared
- as volatile if there's a longjmp() in a function. C++ complains if such
- vars ARE volatile; or more correctly, sans volatile no problem even when
- you longjmp, avec volatile you get unfixable compile errors like
-
-/src/xemacs/lilfix/src/process-unix.c: In function `void
- unix_send_process(Lisp_Object, lstream*)':
-/src/xemacs/lilfix/src/process-unix.c:1577: no matching function for call to `
- Lisp_Object::Lisp_Object(volatile Lisp_Object&)'
-/src/xemacs/lilfix/src/lisp-union.h:32: candidates are:
- Lisp_Object::Lisp_Object(const Lisp_Object&)
-*/
-
-#ifdef __cplusplus
-#define VOLATILE_IF_NOT_CPP
-#else
-#define VOLATILE_IF_NOT_CPP volatile
-#endif
-
-#ifndef PRINTF_ARGS
-# if defined (__GNUC__) && (__GNUC__ >= 2)
-# define PRINTF_ARGS(string_index,first_to_check) \
- __attribute__ ((format (printf, string_index, first_to_check)))
-# else
-# define PRINTF_ARGS(string_index,first_to_check)
-# endif /* GNUC */
-#endif
-
-#ifndef DOESNT_RETURN
-# if defined __GNUC__
-# if ((__GNUC__ > 2) || (__GNUC__ == 2) && (__GNUC_MINOR__ >= 5))
-# if __GNUC__ < 3
- /* GCC 3.2 -O3 issues complaints in Fcommand_loop_1 about no return
- statement if we have this definition */
-# define RETURN_NOT_REACHED(value) DO_NOTHING
-# endif
-# define DOESNT_RETURN void
-# define DECLARE_DOESNT_RETURN(decl) \
- extern void decl __attribute__ ((noreturn))
-# define DECLARE_DOESNT_RETURN_GCC_ATTRIBUTE_SYNTAX_SUCKS(decl,str,idx) \
- /* Should be able to state multiple independent __attribute__s, but \
- the losing syntax doesn't work that way, and screws losing cpp */ \
- extern void decl \
- __attribute__ ((noreturn, format (printf, str, idx)))
-# else
-# define DOESNT_RETURN void volatile
-# define DECLARE_DOESNT_RETURN(decl) extern void volatile decl
-# define DECLARE_DOESNT_RETURN_GCC_ATTRIBUTE_SYNTAX_SUCKS(decl,str,idx) \
- extern void volatile decl PRINTF_ARGS(str,idx)
-# endif /* GNUC 2.5 */
-# else
-# define DOESNT_RETURN void
-# define DECLARE_DOESNT_RETURN(decl) extern void decl
-# define DECLARE_DOESNT_RETURN_GCC_ATTRIBUTE_SYNTAX_SUCKS(decl,str,idx) \
- extern void decl PRINTF_ARGS(str,idx)
-# endif /* GNUC */
-#endif
-
-/* Another try to fix SunPro C compiler warnings */
-/* "end-of-loop code not reached" */
-/* "statement not reached */
-#if defined __SUNPRO_C || defined __USLC__
-#define RETURN_SANS_WARNINGS if (1) return
-#define RETURN_NOT_REACHED(value) DO_NOTHING
-#endif
-
-/* More ways to shut up compiler. This works in Fcommand_loop_1(),
- where there's an infinite loop in a function returning a Lisp object.
-*/
-#if defined (_MSC_VER) || defined (__SUNPRO_C) || defined (__SUNPRO_CC) || \
- (defined (DEC_ALPHA) && defined (OSF1))
-#define DO_NOTHING_DISABLING_NO_RETURN_WARNINGS if (0) return Qnil
-#else
-#define DO_NOTHING_DISABLING_NO_RETURN_WARNINGS DO_NOTHING
-#endif
-
-#ifndef RETURN_NOT_REACHED
-#define RETURN_NOT_REACHED(value) return (value)
-#endif
-
-#ifndef RETURN_SANS_WARNINGS
-#define RETURN_SANS_WARNINGS return
-#endif
-
-#ifndef DO_NOTHING
-#define DO_NOTHING do {} while (0)
-#endif
-
-#ifndef DECLARE_NOTHING
-#define DECLARE_NOTHING struct nosuchstruct
-#endif
-
-/*#ifdef DEBUG_XEMACS*/
-#define REGISTER
-#define register
-/*#else*/
-/*#define REGISTER register*/
-/*#endif*/
-#if defined(HAVE_MS_WINDOWS) && defined(HAVE_SHLIB)
-# ifdef EMACS_MODULE
-# define MODULE_API __declspec(dllimport)
-# else
-# define MODULE_API __declspec(dllexport)
-# endif
-#else
-# define MODULE_API
-#endif
+#include "compiler.h"
/* ------------------------ alignment definitions ------------------- */
@@ -1005,9 +888,7 @@
data of TYPE. */
#define ALIGN_PTR(ptr, type) ((void *) ALIGN_FOR_TYPE ((size_t) (ptr), type))
-#ifdef __cplusplus
-extern "C" {
-#endif
+BEGIN_C_DECLS
/* ------------------------ assertions ------------------- */
@@ -1045,16 +926,6 @@
# endif
#endif
-/* ####
- Why the hell do we do this??????????????????????????????? */
-/*#ifdef DEBUG_XEMACS*/
-#define REGISTER
-#define register
-/*#else*/
-/*#define REGISTER register*/
-/*#endif*/
-
-
/* EMACS_INT is the underlying integral type into which a Lisp_Object must fit.
In particular, it must be large enough to contain a pointer.
config.h can override this, e.g. to use `long long' for bigger lisp ints.
@@ -1067,30 +938,14 @@
# define SIZEOF_EMACS_INT SIZEOF_VOID_P
#endif
-#if 0
-#ifdef USE_ASSERTIONS
-/* Highly dubious kludge */
-/* (thanks, Jamie, I feel better now -- ben) */
-void assert_failed (const char *, int, const char *);
-# define abort() (assert_failed (__FILE__, __LINE__, "abort()"))
-# define assert(x) ((x) ? 1 : (assert_failed (__FILE__, __LINE__, #x), 0))
-#else
-# ifdef DEBUG_XEMACS
-# define assert(x) ((x) ? 1 : ((void) abort (), 0))
-# else
-# define assert(x) (1)
-# endif
-#endif
-#endif /* 0 */
-
/* ------------------------ simple memory allocation ------------------- */
/* Memory allocation */
void malloc_warning (const char *);
-MODULE_API void *xmalloc (Bytecount size);
-MODULE_API void *xmalloc_and_zero (Bytecount size);
-MODULE_API void *xrealloc (void *, Bytecount size);
-MODULE_API char *xstrdup (const char *);
+MODULE_API void *xmalloc (Bytecount size) ATTRIBUTE_MALLOC;
+MODULE_API void *xmalloc_and_zero (Bytecount size) ATTRIBUTE_MALLOC;
+MODULE_API void *xrealloc (void *, Bytecount size) ATTRIBUTE_MALLOC;
+MODULE_API char *xstrdup (const char *) ATTRIBUTE_MALLOC;
/* generally useful */
#define countof(x) ((int) (sizeof(x)/sizeof((x)[0])))
#define xnew(type) ((type *) xmalloc (sizeof (type)))
@@ -1102,7 +957,7 @@
#define alloca_new(type) ((type *) ALLOCA (sizeof (type)))
#define alloca_array(type, len) ((type *) ALLOCA ((len) * sizeof (type)))
-MODULE_API void *xemacs_c_alloca (unsigned int size);
+MODULE_API void *xemacs_c_alloca (unsigned int size) ATTRIBUTE_MALLOC;
MODULE_API int record_unwind_protect_freeing (void *ptr);
@@ -1675,9 +1530,7 @@
/* OK, you can open them again */
-#ifdef __cplusplus
-}
-#endif
+END_C_DECLS
/************************************************************************/
/** Definitions of basic Lisp objects **/
@@ -1685,9 +1538,7 @@
#include "lrecord.h"
-#ifdef __cplusplus
-extern "C" {
-#endif
+BEGIN_C_DECLS
/*------------------------------ unbound -------------------------------*/
@@ -2838,9 +2689,7 @@
int finish_marking_weak_lists (void);
void prune_weak_lists (void);
-#ifdef __cplusplus
-}
-#endif
+END_C_DECLS
/************************************************************************/
/* Definitions related to the format of text and of characters */
@@ -2968,9 +2817,7 @@
#include "symeval.h"
-#ifdef __cplusplus
-extern "C" {
-#endif
+BEGIN_C_DECLS
/* `specpdl' is the special binding/unwind-protect stack.
@@ -3156,9 +3003,7 @@
extern MODULE_API struct gcpro *gcprolist;
-#ifdef __cplusplus
-}
-#endif
+END_C_DECLS
/* #### Catching insufficient gcpro:
@@ -3226,9 +3071,7 @@
and so some "This function can GC" comments may be inaccurate.
*/
-#ifdef __cplusplus
-extern "C" {
-#endif
+BEGIN_C_DECLS
#ifdef DEBUG_GCPRO
@@ -3525,9 +3368,7 @@
int begin_gc_forbidden (void);
void end_gc_forbidden (int count);
-#ifdef __cplusplus
-}
-#endif
+END_C_DECLS
/************************************************************************/
@@ -3553,9 +3394,7 @@
/* Prototypes for all init/syms_of/vars_of initialization functions. */
#include "symsinit.h"
-#ifdef __cplusplus
-extern "C" {
-#endif
+BEGIN_C_DECLS
/* Defined in abbrev.c */
MODULE_API EXFUN (Fexpand_abbrev, 0);
@@ -3920,10 +3759,8 @@
Error_Behavior);
Lisp_Object maybe_signal_continuable_error_1 (Lisp_Object, Lisp_Object,
Lisp_Object, Error_Behavior);
-MODULE_API DECLARE_DOESNT_RETURN_GCC_ATTRIBUTE_SYNTAX_SUCKS (signal_ferror
- (Lisp_Object,
- const CIbyte *,
- ...), 2, 3);
+MODULE_API DECLARE_DOESNT_RETURN (signal_ferror (Lisp_Object, const CIbyte *,
+ ...)) PRINTF_ARGS(2, 3);
void maybe_signal_ferror (Lisp_Object, Lisp_Object, Error_Behavior,
const CIbyte *, ...) PRINTF_ARGS (4, 5);
Lisp_Object signal_continuable_ferror (Lisp_Object, const CIbyte *, ...)
@@ -3943,10 +3780,9 @@
Lisp_Object maybe_signal_continuable_error (Lisp_Object, const CIbyte *,
Lisp_Object,
Lisp_Object, Error_Behavior);
-DECLARE_DOESNT_RETURN_GCC_ATTRIBUTE_SYNTAX_SUCKS (signal_ferror_with_frob
- (Lisp_Object, Lisp_Object,
- const CIbyte *,
- ...), 3, 4);
+DECLARE_DOESNT_RETURN (signal_ferror_with_frob (Lisp_Object, Lisp_Object,
+ const CIbyte *, ...))
+ PRINTF_ARGS(3, 4);
void maybe_signal_ferror_with_frob (Lisp_Object, Lisp_Object, Lisp_Object,
Error_Behavior,
const CIbyte *, ...) PRINTF_ARGS (5, 6);
@@ -4028,10 +3864,9 @@
Lisp_Object frob));
DECLARE_DOESNT_RETURN (stack_overflow (const CIbyte *reason,
Lisp_Object frob));
-MODULE_API
-DECLARE_DOESNT_RETURN_GCC_ATTRIBUTE_SYNTAX_SUCKS (printing_unreadable_object
- (const CIbyte *,
- ...), 1, 2);
+MODULE_API DECLARE_DOESNT_RETURN (printing_unreadable_object (const CIbyte *,
+ ...))
+ PRINTF_ARGS (1, 2);
Lisp_Object signal_void_function_error (Lisp_Object);
Lisp_Object signal_invalid_function_error (Lisp_Object);
@@ -4600,8 +4435,7 @@
void stdout_out (const CIbyte *, ...) PRINTF_ARGS (1, 2);
void external_out (int dest, const CIbyte *fmt, ...) PRINTF_ARGS (2, 3);
void debug_out (const CIbyte *, ...) PRINTF_ARGS (1, 2);
-DECLARE_DOESNT_RETURN_GCC_ATTRIBUTE_SYNTAX_SUCKS (fatal (const CIbyte *,
- ...), 1, 2);
+DECLARE_DOESNT_RETURN (fatal (const CIbyte *, ...)) PRINTF_ARGS(1, 2);
/* Internal functions: */
Lisp_Object canonicalize_printcharfun (Lisp_Object printcharfun);
@@ -5300,8 +5134,6 @@
extern Lisp_Object Vthis_command_keys, Vunread_command_event;
extern Lisp_Object Vx_initial_argv_list;
-#ifdef __cplusplus
-}
-#endif
+END_C_DECLS
#endif /* INCLUDED_lisp_h_ */
Index: src/lrecord.h
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/lrecord.h,v
retrieving revision 1.31
diff -d -u -u -r1.31 lrecord.h
--- src/lrecord.h 2003/09/16 03:57:59 1.31
+++ src/lrecord.h 2003/10/10 22:32:18
@@ -58,9 +58,7 @@
the opaque type. --ben
*/
-#ifdef __cplusplus
-extern "C" {
-#endif
+BEGIN_C_DECLS
struct lrecord_header
{
@@ -1594,8 +1592,6 @@
#endif /* defined (USE_KKCC) || defined (PDUMP) */
-#ifdef __cplusplus
-}
-#endif
+END_C_DECLS
#endif /* INCLUDED_lrecord_h_ */
Index: src/process.h
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/process.h,v
retrieving revision 1.22
diff -d -u -u -r1.22 process.h
--- src/process.h 2003/08/28 15:44:30 1.22
+++ src/process.h 2003/10/10 22:32:18
@@ -36,9 +36,7 @@
#else /* not NO_SUBPROCESSES */
-#ifdef __cplusplus
-extern "C" {
-#endif
+BEGIN_C_DECLS
/* struct Lisp_Process is defined in procimpl.h; only process-*.c need
to know about the guts of it. */
@@ -122,9 +120,7 @@
const char *signal_name (int signum);
Lisp_Object canonicalize_host_name (Lisp_Object host);
-#ifdef __cplusplus
-}
-#endif
+END_C_DECLS
#endif /* not NO_SUBPROCESSES */
Index: src/symeval.h
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/symeval.h,v
retrieving revision 1.11
diff -d -u -u -r1.11 symeval.h
--- src/symeval.h 2003/08/28 15:44:30 1.11
+++ src/symeval.h 2003/10/10 22:32:18
@@ -27,9 +27,7 @@
#ifndef INCLUDED_symeval_h_
#define INCLUDED_symeval_h_
-#ifdef __cplusplus
-extern "C" {
-#endif
+BEGIN_C_DECLS
enum symbol_value_type
{
@@ -434,8 +432,6 @@
void flush_all_buffer_local_cache (void);
-#ifdef __cplusplus
-}
-#endif
+END_C_DECLS
#endif /* INCLUDED_symeval_h_ */
Index: src/sysdll.h
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/sysdll.h,v
retrieving revision 1.4
diff -d -u -u -r1.4 sysdll.h
--- src/sysdll.h 2003/09/22 03:21:19 1.4
+++ src/sysdll.h 2003/10/10 22:32:18
@@ -22,9 +22,7 @@
#ifndef INCLUDED_sysdll_h_
#define INCLUDED_sysdll_h_
-#ifdef __cplusplus
-extern "C" {
-#endif
+BEGIN_C_DECLS
#if defined(WIN32_NATIVE)
#define DLLEXPORT __declspec(dllexport)
@@ -46,13 +44,11 @@
extern dll_var dll_variable(dll_handle, const CIbyte *);
extern Lisp_Object dll_error(dll_handle);
-#ifdef __cplusplus
-}
-#endif
-
/* More stand-ins ... */
#define Qdll_filename_encoding Qfile_name
#define Qdll_function_name_encoding Qnative
+
+END_C_DECLS
#endif /* INCLUDED_sysdll_h_ */
Index: src/syswindows.h
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/syswindows.h,v
retrieving revision 1.21
diff -d -u -u -r1.21 syswindows.h
--- src/syswindows.h 2003/09/15 21:19:17 1.21
+++ src/syswindows.h 2003/10/10 22:32:18
@@ -70,18 +70,14 @@
# define _WIN32_IE 0x0400
# endif
-#ifdef __cplusplus
-extern "C" {
-#endif
+BEGIN_C_DECLS
/* Fucking GCC complains about "no previous prototype" for inline
functions. DUH! See DECLARE_INLINE_HEADER. */
extern __inline void *GetCurrentFiber (void);
extern __inline void *GetFiberData (void);
-#ifdef __cplusplus
-}
-#endif
+END_C_DECLS
#endif
@@ -851,16 +847,16 @@
/* ------------------------- Filename conversion ------------------------- */
#ifdef CYGWIN
-#ifdef __cplusplus
-extern "C" {
-#endif
+
+BEGIN_C_DECLS
+
void cygwin_win32_to_posix_path_list (const char *, char *);
int cygwin_win32_to_posix_path_list_buf_size (const char *);
void cygwin_posix_to_win32_path_list (const char *, char *);
int cygwin_posix_to_win32_path_list_buf_size (const char *);
-#ifdef __cplusplus
-}
-#endif
+
+END_C_DECLS
+
#endif
#define LOCAL_FILE_FORMAT_TO_TSTR(path, out) \
Index: src/text.h
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/text.h,v
retrieving revision 1.20
diff -d -u -u -r1.20 text.h
--- src/text.h 2003/09/30 15:27:00 1.20
+++ src/text.h 2003/10/10 22:32:19
@@ -45,9 +45,7 @@
char *strupr (char *);
#endif
-#ifdef __cplusplus
-extern "C" {
-#endif
+BEGIN_C_DECLS
/* ---------------------------------------------------------------------- */
/* Super-basic character properties */
@@ -2455,9 +2453,7 @@
#define eilwr(ei) EI_CASECHANGE (ei, 1)
#define eiupr(ei) EI_CASECHANGE (ei, 0)
-#ifdef __cplusplus
-}
-#endif
+END_C_DECLS
/************************************************************************/
@@ -2698,9 +2694,7 @@
};
typedef enum dfc_conversion_type dfc_conversion_type;
-#ifdef __cplusplus
-extern "C" {
-#endif
+BEGIN_C_DECLS
/* WARNING: These use a static buffer. This can lead to disaster if
these functions are not used *very* carefully. Another reason to only use
@@ -2909,9 +2903,7 @@
enum new_dfc_src_type type,
Lisp_Object codesys);
-#ifdef __cplusplus
-}
-#endif
+END_C_DECLS
/* Version of EXTERNAL_TO_C_STRING that *RETURNS* the translated string,
still in alloca() space. Requires some trickiness to do this, but gets
Index: src/s/windowsnt.h
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/s/windowsnt.h,v
retrieving revision 1.28
diff -d -u -u -r1.28 windowsnt.h
--- src/s/windowsnt.h 2003/02/05 06:20:54 1.28
+++ src/s/windowsnt.h 2003/10/10 22:32:19
@@ -242,12 +242,7 @@
/* MSVC 6.0 has a mechanism to declare functions which never return */
#if (_MSC_VER >= 1200)
#define DOESNT_RETURN __declspec(noreturn) void
-#define DECLARE_DOESNT_RETURN(decl) __declspec(noreturn) extern void decl
-#define DECLARE_DOESNT_RETURN_GCC_ATTRIBUTE_SYNTAX_SUCKS(decl,str,idx) \
- __declspec(noreturn) extern void __cdecl decl PRINTF_ARGS(str,idx)
-#else
-#define DECLARE_DOESNT_RETURN_GCC_ATTRIBUTE_SYNTAX_SUCKS(decl,str,idx) \
- extern void __cdecl decl PRINTF_ARGS(str,idx)
+#define DECLARE_DOESNT_RETURN(decl) __declspec(noreturn) extern void XCDECL decl
#endif /* MSVC 6.0 */
/* MSVC warnings no-no crap. When adding one to this section,
--
Jerry James
http://www.ittc.ku.edu/~james/