[omniORB] omniorb with gcc 4.4 : getline, getopt, EOF

Jiang Wei sdjiangwei at gmail.com
Wed May 6 21:39:27 BST 2009


$ gcc --version
gcc (GCC) 4.4.0 20090427 (Red Hat 4.4.0-3)


$ configure & make
... ...
make[3]: Entering directory `/home/jw/omni/build/src/tool/omkdepend'
gcc -c -O  -DDEBUG -I. -I../../../../src/tool/omkdepend -I../../../include -
I../../../../include -D__OSVERSION__=2 -D__linux__ -D__x86__ -o include.o 
../../../../src/tool/omkdepend/include.c
In file included from ../../../../src/tool/omkdepend/include.c:31:
../../../../src/tool/omkdepend/def.h:132: error: conflicting types for 
'getline'
/usr/include/stdio.h:653: note: previous declaration of 'getline' was here


$ rename getline to get_line, and make 
...
../../../../../src/appl/utils/catior/catior.cc: In function 'int main(int, 
char**)':
../../../../../src/appl/utils/catior/catior.cc:363: error: 'EOF' was not 
declared in thi	

../../../../../src/appl/utils/convertior/convertior.cc: In function 'int 
main(int, char**)':
../../../../../src/appl/utils/convertior/convertior.cc:153: error: 'EOF' was 
not declared in this scope


$ man getopt

     The getopt() function was once specified to return EOF instead of -1.
     This was changed by IEEE Std 1003.2-1992 ("POSIX.2") to decouple getopt()
     from <stdio.h>.

$ change EOF to -1 & make , Successed.

$ cvs diff -u


Index: src/appl/utils/catior/catior.cc                                                  
===================================================================                     
RCS file: /cvsroot/omniorb/omni/src/appl/utils/catior/Attic/catior.cc,v                 
retrieving revision 1.14.2.3                                                            
diff -u -r1.14.2.3 catior.cc                                                            
--- src/appl/utils/catior/catior.cc     22 May 2005 12:39:44 -0000      
1.14.2.3        
+++ src/appl/utils/catior/catior.cc     6 May 2009 12:38:04 -0000                       
@@ -360,7 +360,7 @@                                                                     
   int hexflag = 0;                                                                     
   int omniflag = 0;                                                                    
                                                                                        
-  while((c = getopt(argc,argv,"xo")) != EOF) {                                         
+  while((c = getopt(argc,argv,"xo")) != -1) {                                          
     switch(c) {                                                                        
     case 'x':                                                                          
       hexflag = 1;                                                                     
Index: src/appl/utils/convertior/convertior.cc                                          
===================================================================                     
RCS file: 
/cvsroot/omniorb/omni/src/appl/utils/convertior/Attic/convertior.cc,v         
retrieving revision 1.11.2.3                                                            
diff -u -r1.11.2.3 convertior.cc                                                        
--- src/appl/utils/convertior/convertior.cc     22 May 2005 12:39:43 -0000      
1.11.2.3
+++ src/appl/utils/convertior/convertior.cc     6 May 2009 12:38:04 -0000               
@@ -150,7 +150,7 @@                                                                     
                                                                                        
   int c;                                                                               
                                                                                        
-  while((c = getopt(argc,argv,"x")) != EOF)                                            
+  while((c = getopt(argc,argv,"x")) != -1)                                             
     {                                                                                  
       switch(c)                                                                        
        {                                                                               
Index: src/tool/omkdepend/def.h                                                         
===================================================================                     
RCS file: /cvsroot/omniorb/omni/src/tool/omkdepend/Attic/def.h,v                        
retrieving revision 1.4.2.4                                                             
diff -u -r1.4.2.4 def.h                                                                 
--- src/tool/omkdepend/def.h    12 Dec 2008 12:13:19 -0000      1.4.2.4                 
+++ src/tool/omkdepend/def.h    6 May 2009 12:38:04 -0000                               
@@ -129,7 +129,7 @@                                                                     
                                                                                        
 char                   *copy();                                                        
 char                   *base_name();                                                   
-char                   *getline();                                                     
+char                   *get_line();                                                    
 struct symtab          *slookup();                                                     
 struct symtab          *isdefined();                                                   
 struct symtab          *fdefined();                                                    
Index: src/tool/omkdepend/main.c                                                        
===================================================================                     
RCS file: /cvsroot/omniorb/omni/src/tool/omkdepend/Attic/main.c,v                       
retrieving revision 1.8.2.3                                                             
diff -u -r1.8.2.3 main.c                                                                
--- src/tool/omkdepend/main.c   29 Dec 2008 14:38:31 -0000      1.8.2.3                 
+++ src/tool/omkdepend/main.c   6 May 2009 12:38:04 -0000                               
@@ -470,7 +470,7 @@                                                                     
  * Get the next line.  We only return lines beginning with '#' since that
  * is all this program is ever interested in.
  */
-char *getline(filep)
+char *get_line(filep)
        register struct filepointer     *filep;
 {
        register char   *p,     /* walking pointer */
Index: src/tool/omkdepend/parse.c
===================================================================
RCS file: /cvsroot/omniorb/omni/src/tool/omkdepend/Attic/parse.c,v
retrieving revision 1.2.2.3
diff -u -r1.2.2.3 parse.c
--- src/tool/omkdepend/parse.c  29 Dec 2008 14:38:31 -0000      1.2.2.3
+++ src/tool/omkdepend/parse.c  6 May 2009 12:38:04 -0000
@@ -45,7 +45,7 @@
        register int    type;
        boolean recfailOK;

-       while (line = getline(filep)) {
+       while (line = get_line(filep)) {
                switch(type = deftype(line, filep, file_red, file, TRUE)) {
                case IF:
                doif:
@@ -170,7 +170,7 @@
        register char   *line;
        register int    type;

-       while (line = getline(filep)) {
+       while (line = get_line(filep)) {
                switch(type = deftype(line, filep, file_red, file, FALSE)) {
                case IF:
                case IFFALSE:




More information about the omniORB-list mailing list