[PATCH] Various fixes



Hi,

Please find attached a couple of fixes I needed to get ORBit2
compiling with GCC 3.x.

For libIDL:

  From  Raja R Harinath  <harinath@cs.umn.edu>

        * lexer.l (cpp_status): Handle GNU CPP 3.x pseudo-filenames
        "<stdin>", "<builtin>" and "<command line>".

>From  Raja R Harinath  <harinath@cs.umn.edu>

	* lexer.l (cpp_status): Handle GNU CPP 3.x pseudo-filenames
	"<stdin>", "<builtin>" and "<command line>".

Index: lexer.l
===================================================================
RCS file: /cvs/gnome/libIDL/lexer.l,v
retrieving revision 1.76
diff -u -p -u -r1.76 lexer.l
--- lexer.l	2001/08/23 12:45:45	1.76
+++ lexer.l	2001/09/18 22:41:44
@@ -174,27 +174,40 @@ dqstring		\"[^\"\n]*[\"\n]
 	__IDL_do_pragma (s);
 }
 <*>{cpp_status}						{
-	char *starttext;
+	char *p;
 	char *filename;
 	char *filename2;
 	int line;
 
-	starttext = yytext;
-	while (isspace ((int)*starttext)) ++starttext;
-	filename = g_malloc (strlen (starttext) + 1);
-
-	sscanf (starttext, "# %d %s", &line, filename);
-
-	if (*filename == '"') {
-		filename2 = g_strdup (filename + 1);
-		filename2[strlen (filename) - 2] = 0;
-		g_free (filename);
-	} else
-		filename2 = filename;
+	p = yytext;
+	while (isspace ((int)*p)) ++p;
+	++p;			/* Skip over '#' */
 
+	line = strtol (p, &filename, 0);
+	p = filename;
+	while (*p && isspace ((int)*p)) ++p;
+
+	filename = g_strdup(p);
+
+	filename2 = filename;
+	if (*filename2 == '"') {
+		++filename2;
+		p = filename2;
+		while (*p && *p != '"') ++p;
+		*p = '\0';
+	}
+
+	/* Treat GNU CPP-3.x "<stdin>", "<builtin>" and "<command line>"
+	   pseudo-filenames like "" */
+	if (*filename2 == '<'
+	    && (strcmp (filename2, "<builtin>") == 0
+		|| strcmp (filename2, "<stdin>") == 0
+		|| strcmp (filename2, "<command line>") == 0))
+		*filename2 = '\0';
+	
 	yylval.tree = IDL_file_set (filename2, line);
 
-	g_free (filename2);
+	g_free (filename);
 	if ( yylval.tree )
 	 	tokreturn (TOK_SRCFILE);
 }

  From  Raja R Harinath  <harinath@cs.umn.edu>

	* src/orb/orb-core/corba-typecode.c: Have 
        definitions of '*_struct's agree with declarations 
        in include/orbit/orb-core/corba-typecode.h.

Index: src/orb/orb-core/corba-typecode.c
===================================================================
RCS file: /cvs/gnome/ORBit2/src/orb/orb-core/corba-typecode.c,v
retrieving revision 1.20
diff -u -p -u -r1.20 corba-typecode.c
--- src/orb/orb-core/corba-typecode.c	2001/09/10 02:07:20	1.20
+++ src/orb/orb-core/corba-typecode.c	2001/09/18 23:10:59
@@ -123,7 +123,7 @@ const ORBit_RootObject_Interface ORBit_T
 };
 
 #define DEF_TC_BASIC(nom, c_align)                               \
-	struct CORBA_TypeCode_struct TC_CORBA_##nom##_struct = {  \
+	const struct CORBA_TypeCode_struct TC_CORBA_##nom##_struct = {  \
 		{&ORBit_TypeCode_epv, ORBIT_REFCOUNT_STATIC},    \
 		CORBA_tk_##nom,                                  \
 		#nom,                                            \
@@ -139,14 +139,14 @@ const ORBit_RootObject_Interface ORBit_T
 #define CORBA_tk_unsigned_short CORBA_tk_ushort
 #define CORBA_tk_long_double CORBA_tk_longdouble
 
-struct CORBA_TypeCode_struct TC_null_struct = {
+const struct CORBA_TypeCode_struct TC_null_struct = {
   {&ORBit_TypeCode_epv, ORBIT_REFCOUNT_STATIC},
   CORBA_tk_null,
   "null",
   "Null",
   0, 0, NULL, NULL, NULL, CORBA_OBJECT_NIL, -1, 0, 0, 0, -1
 };
-struct CORBA_TypeCode_struct TC_void_struct = {
+const struct CORBA_TypeCode_struct TC_void_struct = {
   {&ORBit_TypeCode_epv, ORBIT_REFCOUNT_STATIC},
   CORBA_tk_void,
   "void",

- Hari
-- 
Raja R Harinath ------------------------------ harinath@cs.umn.edu
"When all else fails, read the instructions."      -- Cahn's Axiom
"Our policy is, when in doubt, do the right thing."   -- Roy L Ash


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