[PATCH] Re: Serious bug in idl compiler (non-compiling generated files)



On Tue, 2004-12-21 at 12:17 +0100, Jules Colding wrote:
> Hi all,
> 
> Valid IDL code like:
> 
> 	const char N = '\x0A';
> 
> will result in:
> 
> 	#ifndef N
> 	#define N '
> 	'
> 	#endif /* !N */
> 
> which obviously does not compile. To make matters worse:
> 
> 	const char T = '\x09';
> 
> results in:
> 
> 	#ifndef T
> 	#define T '	'
> 	#endif /* !T */
> 
> which is just plain ugly to read in a header file for a type where the
> client is expected to do "switch()" on a const CORBA char.

This patch fixed the problem for me. Any comments?

-- 
  jules


diff -uprN ORBit2/ChangeLog ORBit2.orig/ChangeLog
--- ORBit2/ChangeLog	2004-12-21 13:22:49.908315645 +0100
+++ ORBit2.orig/ChangeLog	2004-12-17 13:39:42.000000000 +0100
@@ -1,8 +1,3 @@
-2004-12-21  Jules Colding  <colding omesc com>
-
-	* src/idl-compiler/orbit-idl-c-utils.c (orbit_cbe_get_const): Fix idl compilation
-	of "const char N = '\x0A';" definitions.
-
 2004-12-17  Michael Meeks  <michael meeks novell com>
 
 	* src/orb/orb-core/corba-any.c (ORBit_demarshal_value):
diff -uprN ORBit2/src/idl-compiler/orbit-idl-c-utils.c ORBit2.orig/src/idl-compiler/orbit-idl-c-utils.c
--- ORBit2/src/idl-compiler/orbit-idl-c-utils.c	2004-12-21 13:22:09.112071291 +0100
+++ ORBit2.orig/src/idl-compiler/orbit-idl-c-utils.c	2004-08-13 12:37:27.000000000 +0200
@@ -345,7 +345,7 @@ orbit_cbe_get_const(IDL_tree tree)
     g_string_printf(tmpstr, "%s", IDL_BOOLEAN(tree).value?"CORBA_TRUE":"CORBA_FALSE");
     break;
   case IDLN_CHAR:
-    g_string_printf(tmpstr, "'\\x%X'", *(unsigned char *)IDL_CHAR(tree).value);
+    g_string_printf(tmpstr, "'%s'", IDL_CHAR(tree).value);
     break;
   case IDLN_FLOAT:
     g_string_printf(tmpstr, "%f", IDL_FLOAT(tree).value);




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