Re: header guards conflicts



le mer 20-03-2002 à 15:34, Murray Cumming a écrit :
> Actually it might be a lot simpler to add a --headerguardprefix option
> to orbit-idl-2. Would that be acceptable?

To implement this, I've already committed this patch to the cpp branch:

-- 
Murray Cumming
murrayc usa net
www.murrayc.com
? INSTALL
? ORBit-2.0-cpp.pc
? ORBit2.kdevprj
? ORBit2.kdevses
? headerguard.diff
? install-sh
? missing
? mkinstalldirs
? temp.diff
? src/idl-compiler/cpp/types/Makefile
? src/idl-compiler/cpp/types/Makefile.in
? src/orb/orb-core/orbit-interface-common.c2
? test/cpp/Makefile
? test/cpp/Makefile.in
? test/cpp/helloworld/Makefile
? test/cpp/helloworld/Makefile.in
? test/cpp/helloworld/generated/Makefile
? test/cpp/helloworld/generated/Makefile.in
? test/cpp/struct-simple/Makefile
? test/cpp/struct-simple/Makefile.in
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/ORBit2/ChangeLog,v
retrieving revision 1.286.2.41
diff -u -p -r1.286.2.41 ChangeLog
--- ChangeLog	16 Mar 2002 15:14:55 -0000	1.286.2.41
+++ ChangeLog	24 Mar 2002 17:26:37 -0000
@@ -1,3 +1,9 @@
+2002-03-24  Murray Cumming  <murrayc usa net>
+
+	* Added --headerguardprefix option to orbit-idl-2. This allows the
+	C++ bindings to use generated C bindings which in turn #include
+	already-generated installed C bindings.
+
 2002-03-16  ERDI Gergo  <cactus cactus rulez org>
 
 	* src/idl-compiler/cpp/types/IDLType.cc: Don't use _forwarder
Index: src/idl-compiler/orbit-idl-c-headers.c
===================================================================
RCS file: /cvs/gnome/ORBit2/src/idl-compiler/orbit-idl-c-headers.c,v
retrieving revision 1.56.2.2
diff -u -p -r1.56.2.2 orbit-idl-c-headers.c
--- src/idl-compiler/orbit-idl-c-headers.c	15 Mar 2002 18:58:00 -0000	1.56.2.2
+++ src/idl-compiler/orbit-idl-c-headers.c	24 Mar 2002 17:26:37 -0000
@@ -19,8 +19,8 @@ orbit_idl_output_c_headers(OIDL_Output_T
 	  " * This file was generated by orbit-idl - DO NOT EDIT!\n"
 	  " */\n\n");
 
-  fprintf(ci->fh, "#ifndef %s_H\n", ci->c_base_name);
-  fprintf(ci->fh, "#define %s_H 1\n", ci->c_base_name);
+  fprintf(ci->fh, "#ifndef %s%s_H\n", rinfo->header_guard_prefix, ci->c_base_name);
+  fprintf(ci->fh, "#define %s%s_H 1\n", rinfo->header_guard_prefix, ci->c_base_name);
 
   fprintf(ci->fh, "#include <glib.h>\n");
   fprintf(ci->fh, "#define ORBIT_IDL_SERIAL %d\n", ORBIT_CONFIG_SERIAL);
Index: src/idl-compiler/orbit-idl-main.c
===================================================================
RCS file: /cvs/gnome/ORBit2/src/idl-compiler/orbit-idl-main.c,v
retrieving revision 1.21
diff -u -p -r1.21 orbit-idl-main.c
--- src/idl-compiler/orbit-idl-main.c	24 Aug 2001 18:56:45 -0000	1.21
+++ src/idl-compiler/orbit-idl-main.c	24 Mar 2002 17:26:37 -0000
@@ -53,6 +53,7 @@ static int cl_add_imodule = 0;
 static gboolean cl_disable_defs_skels = FALSE;
 static gboolean cl_showcpperrors = TRUE;
 static char *cl_output_lang = "c";
+static char *cl_header_guard_prefix = "";
 static char *cl_backend_dir = ORBITLIBDIR;
 static gboolean cl_onlytop = FALSE;
 static char *cl_deps_file = NULL;
@@ -135,6 +136,7 @@ struct poptOption options[] = {
   {"pidl", '\0', POPT_ARG_NONE, &cl_is_pidl, 0, "Treat as Pseudo IDL", NULL},
   {"nodefskels", '\0', POPT_ARG_NONE, &cl_disable_defs_skels, 0, "Don't output defs for skels in header", NULL},
   {"deps", '\0', POPT_ARG_STRING, &cl_deps_file, 0, "Generate dependency info suitable for inclusion in Makefile", "FILENAME"},
+  {"headerguardprefix", '\0', POPT_ARG_STRING, &cl_header_guard_prefix, 0, "Prefix for #ifdef header guards. Sometimes useful to avoid conflicts.", NULL},
   POPT_AUTOHELP
   {NULL, '\0', 0, NULL, 0, NULL, NULL}
 };
@@ -204,6 +206,7 @@ int main(int argc, const char *argv[])
 
   rinfo.output_formatter = c_output_formatter;
   rinfo.output_language = cl_output_lang;
+  rinfo.header_guard_prefix = cl_header_guard_prefix;
   rinfo.backend_directory = cl_backend_dir;
   rinfo.onlytop = cl_onlytop;
   rinfo.small = cl_enable_small_stubs || cl_enable_small_skels;
Index: src/idl-compiler/orbit-idl3-types.h
===================================================================
RCS file: /cvs/gnome/ORBit2/src/idl-compiler/orbit-idl3-types.h,v
retrieving revision 1.16.2.1
diff -u -p -r1.16.2.1 orbit-idl3-types.h
--- src/idl-compiler/orbit-idl3-types.h	11 Dec 2001 09:39:09 -0000	1.16.2.1
+++ src/idl-compiler/orbit-idl3-types.h	24 Mar 2002 17:26:37 -0000
@@ -35,6 +35,7 @@ typedef struct {
   char *input_filename;
   char *backend_directory;
   char *deps_file;
+  char *header_guard_prefix;
   gboolean onlytop;
   gboolean small;
   gboolean small_stubs;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]