changeset 5183:f283b08ff0c9

Avoid build failure, Apple's g++-4.0.1, Mac OS 10.4. 2010-04-02 Aidan Kehoe <kehoea@parhasard.net> Avoid build failure, Apple's g++-4.0.1, Mac OS 10.4. * sysdll.c (search_linked_libs, dll_variable): Correct some casts for the C++ build. * regex.h (END_C_DECLS, BEGIN_C_DECLS): Wrap function declarations in extern "C" { ... } on the C++ build. * mule-ccl.c (ccl_driver): Initialise i, silencing a warning on a C++ build. * keymap.c (key_desc_list_to_event): Work around a bug in Apple's g++-4.0.1.
author Aidan Kehoe <kehoea@parhasard.net>
date Fri, 02 Apr 2010 12:21:02 +0100
parents 2e528066e2fc
children 039d9a7f2e6d
files src/ChangeLog src/keymap.c src/mule-ccl.c src/regex.h src/sysdll.c
diffstat 5 files changed, 37 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Thu Apr 01 20:22:50 2010 +0100
+++ b/src/ChangeLog	Fri Apr 02 12:21:02 2010 +0100
@@ -1,3 +1,15 @@
+2010-04-02  Aidan Kehoe  <kehoea@parhasard.net>
+
+	Avoid build failure, Apple's g++-4.0.1, Mac OS 10.4.
+	* sysdll.c (search_linked_libs, dll_variable): Correct some casts
+	for the C++ build.
+	* regex.h (END_C_DECLS, BEGIN_C_DECLS): Wrap function declarations
+	in extern "C" { ... } on the C++ build.
+	* mule-ccl.c (ccl_driver): Initialise i, silencing a warning on
+	a C++ build.
+	* keymap.c (key_desc_list_to_event):
+	Work around a bug in Apple's g++-4.0.1.
+
 2010-03-31  Aidan Kehoe  <kehoea@parhasard.net>
 
 	* fns.c (STRING_DATA_TO_OBJECT_ARRAY)
--- a/src/keymap.c	Thu Apr 01 20:22:50 2010 +0100
+++ b/src/keymap.c	Fri Apr 02 12:21:02 2010 +0100
@@ -1528,7 +1528,13 @@
 
   define_key_parser (list, &raw_key);
 
-  if (
+  /* The first zero is needed for Apple's i686-apple-darwin8-g++-4.0.1,
+     otherwise the build fails with:
+
+     In function ‘void key_desc_list_to_event(Lisp_Object, Lisp_Object, int)’:
+     cc1plus: error: expected primary-expression
+     cc1plus: error: expected `)'  */
+  if (0 ||
 #define INCLUDE_BUTTON_ZERO
 #define FROB(num)				\
       EQ (raw_key.keysym, Qbutton##num) ||	\
--- a/src/mule-ccl.c	Thu Apr 01 20:22:50 2010 +0100
+++ b/src/mule-ccl.c	Fri Apr 02 12:21:02 2010 +0100
@@ -953,7 +953,7 @@
   register Lisp_Object *ccl_prog = ccl->prog;
   const unsigned char *src = source, *src_end = src + src_bytes;
   int jump_address;
-  int i, j, op;
+  int i = 0, j, op;
   int stack_idx = ccl->stack_idx;
   /* Instruction counter of the current CCL code. */
   int this_ic = 0;
--- a/src/regex.h	Thu Apr 01 20:22:50 2010 +0100
+++ b/src/regex.h	Fri Apr 02 12:21:02 2010 +0100
@@ -42,6 +42,18 @@
 #define Bytecount ssize_t
 #endif /* emacs */
 
+#ifndef emacs
+# ifdef __cplusplus
+#  define BEGIN_C_DECLS extern "C" {
+#  define END_C_DECLS }
+# else
+#  define BEGIN_C_DECLS
+#  define END_C_DECLS
+# endif
+#endif /* emacs */
+
+BEGIN_C_DECLS
+
 /* POSIX says that <sys/types.h> must be included (by the caller) before
    <regex.h>.  */
 
@@ -535,4 +547,6 @@
 
 extern int debug_regexps;
 
+END_C_DECLS
+
 #endif /* INCLUDED_regex_h_ */
--- a/src/sysdll.c	Thu Apr 01 20:22:50 2010 +0100
+++ b/src/sysdll.c	Fri Apr 02 12:21:02 2010 +0100
@@ -368,9 +368,9 @@
 	  struct mach_header *wh;
 
 	  if ((wh = (struct mach_header *)
-	       my_find_image((Rawbyte *)
+	       my_find_image((const Chbyte *)
 			     (((struct dylib_command *) lc)->
-			      dylib.name.offset + (Rawbyte *) lc))))
+			      dylib.name.offset + (const Chbyte *) lc))))
 	    {
 	      Extbyte *symext =
 		ITEXT_TO_EXTERNAL (symbol, Qdll_symbol_encoding);
@@ -442,7 +442,7 @@
   MAYBE_PREPEND_UNDERSCORE (n);
   next = ITEXT_TO_EXTERNAL (n, Qdll_variable_name_encoding);
 
-  sym = NSLookupSymbolInModule ((NSModule) h, n);
+  sym = NSLookupSymbolInModule ((NSModule) h, (const Chbyte *)n);
   if (sym == 0) return 0;
   return (dll_var) NSAddressOfSymbol (sym);
 }