Bug 2008

Summary: Problems compiling with gcc 4.0
Product: xorg Reporter: Falk Hueffner <falk>
Component: Server/GeneralAssignee: Xorg Project Team <xorg-team>
Status: RESOLVED FIXED QA Contact: Xorg Project Team <xorg-team>
Severity: normal    
Priority: high CC: ajax, roland.mainz
Version: git   
Hardware: Alpha   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Bug Depends on: 2254    
Bug Blocks:    

Description Falk Hueffner 2004-12-03 16:45:17 UTC
Hi,

the current CVS doesn't compile with gcc 4.0 because of mixing static
and non-static declarations, which doesn't make any sense and is disallowed in
gcc 4.0:

gcc -c -O2 -ansi -pedantic -Wall -Wpointer-arith -Wstrict-prototypes            
          -Wmissing-prototypes -Wmissing-declarations                    
-Wredundant-decls -Wnested-externs -Wundef   -fno-merge-constants
-I../../../exports/include/X11 -I. -I../mfb -I../mi -I../cfb             
-I../include -I../../../include -I../../../lib             
-I../../../include/extensions -I../../../include/fonts -I../../../lib/X11 
-I../../.. -I../../../exports/include   -Dlinux -D__alpha__
-D_POSIX_C_SOURCE=199309L                              -D_POSIX_SOURCE
-D_XOPEN_SOURCE                                 -D_BSD_SOURCE -D_SVID_SOURCE   
                         -D_GNU_SOURCE                           -DSHAPE
-DXINPUT -DXKB -DLBX -DXAPPGROUP       -DXCSECURITY -DTOGCUP   -DXF86BIGFONT
-DDPMSExtension    -DPIXPRIV -DPANORAMIX   -DRENDER -DRANDR       -DXFIXES
-DDAMAGE -DCOMPOSITE -DXEVIE    -DGCCUSESGAS -DAVOID_GLYPHBLT -DPIXPRIV
-DSINGLEDEPTH                          -DXFreeXDGA -DXvExtension               
               -DXFree86LOADER  -DXFree86Server                               
-DXF86VIDMODE                           -DXvMCExtension                        
        -DSMART_SCHEDULE                                -DBUILDDEBUG
-DXResExtension                    
        -DX_BYTE_ORDER=X_LITTLE_ENDIAN                         
-DXORG_VERSION_CURRENT="(((6) * 10000000) + ((8) * 100000) + ((1) * 1000) + 99)"
-D_XSERVER64 -DJENSEN_SUPPORT -DNDEBUG   -DFUNCPROTO=15 -DNARROWPROTO  
-DXPRINTDIR=\"/usr/X11R6/lib/X11/xserver\" -DXPRASTERDDX -DXPPCLDDX
-DXPMONOPCLDDX          -DXPPSDDX -DHAS_MKSTEMP -UXFree86LOADER
-D_XP_PRINT_SERVER_   attributes.c
In file included from AttrValid.h:38,
                 from attributes.h:38,
                 from attributes.c:60:
Oid.h:208: warning: function declaration isn't a prototype
In file included from attributes.h:38,
                 from attributes.c:60:
AttrValid.h:181: warning: function declaration isn't a prototype
attributes.c:144: warning: function declaration isn't a prototype
attributes.c: In function 'XpGetConfigDirBase':
attributes.c:152: warning: assignment from incompatible pointer type
attributes.c:152: warning: comparison of distinct pointer types lacks a cast
attributes.c:153: warning: assignment from incompatible pointer type
attributes.c:155: warning: return from incompatible pointer type
attributes.c: In function 'BuildPrinterAttrs':
attributes.c:327: warning: unused variable 'dirName'
attributes.c: In function 'XpGetOneAttribute':
attributes.c:627: warning: unused variable 'retVal'
attributes.c: In function 'AppendEntry':
attributes.c:819: warning: 'return' with no value, in function returning non-voi
d
attributes.c: In function 'XpGetAttributes':
attributes.c:878: warning: unused variable 'retVal'
attributes.c: At top level:
attributes.c:1094: error: static declaration of 'ExecCommand' follows non-static
 declaration
attributes.h:113: error: previous declaration of 'ExecCommand' was here
attributes.c: In function 'SendFileToCommand':
attributes.c:1187: warning: implicit declaration of function 'initgroups'
attributes.c:1187: warning: nested extern declaration of 'initgroups'
attributes.c:1202: warning: unused variable 'res'
attributes.c: At top level:
attributes.c:1223: warning: redundant redeclaration of 'ReplaceAnyString'
attributes.h:108: warning: previous declaration of 'ReplaceAnyString' was here
attributes.c: In function 'VectorizeCommand':
attributes.c:1440: warning: unused variable 'i'
attributes.c:1439: warning: unused variable 'curTok'
attributes.c: In function 'XpSubmitJob':
attributes.c:1466: warning: unused variable 'cmdOpt'
attributes.c: In function 'XpGetTrayMediumFromContext':
attributes.c:1592: warning: unused variable 'pLast'
attributes.c:1592: warning: unused variable 'pE'
attributes.c:1592: warning: unused variable 'pS'
make[5]: *** [attributes.o] Error 1
make[5]: Leaving directory `/src/xc-2004.12.04/programs/Xserver/Xprint'
Comment 1 Falk Hueffner 2004-12-03 17:31:16 UTC
Some more:

make[7]: Entering directory
`/src/xc-2004.12.04/programs/Xserver/hw/xfree86/drivers/ati'
[...]
gcc -O2 -ansi -pedantic -Wall -Wpointer-arith -Wstrict-prototypes 			 
-Wmissing-prototypes -Wmissing-declarations 			  -Wredundant-decls
-Wnested-externs -Wundef   -fno-merge-constants -I. -I../i2c
-I../../../../../../programs/Xserver/hw/xfree86/common
-I../../../../../../programs/Xserver/hw/xfree86/os-support
-I../../../../../../programs/Xserver/hw/xfree86           
-I../../../../../../programs/Xserver/hw/xfree86/vbe
-I../../../../../../programs/Xserver/hw/xfree86/int10           
-I../../../../../../programs/Xserver/hw/xfree86/ddc
-I../../../../../../programs/Xserver/hw/xfree86/i2c           
-I../../../../../../programs/Xserver/hw/xfree86/rac
-I../../../../../../programs/Xserver/hw/xfree86/ramdac           
-I../../../../../../programs/Xserver/hw/xfree86/shadowfb
-I../../../../../../programs/Xserver/hw/xfree86/xaa           
-I../../../../../../programs/Xserver/hw/xfree86/xf4bpp
-I../../../../../../programs/Xserver/hw/xfree86/xf1bpp           
-I../../../../../../programs/Xserver/hw/xfree86/vgahw
-I../../../../../../programs/Xserver/hw/xfree86/fbdevhw           
-I../../../../../../programs/Xserver/mfb -I../../../../../../programs/Xserver/fb
-I../../../../../../programs/Xserver/mi           
-I../../../../../../programs/Xserver/miext/shadow           
-I../../../../../../programs/Xserver/render
-I../../../../../../programs/Xserver/Xext
-I../../../../../../programs/Xserver/include           
-I../../../../../../programs/Xserver/GL/dri -I../../../../../../lib/GL/dri
-I../../../../../../include               -I../../../../../../extras/drm/shared
-I../../../../../../include/fonts -I../../../../../../include/extensions
-I../../../../../../exports/include/X11  -I../../../../../..
-I../../../../../../exports/include   -Dlinux -D__alpha__
-D_POSIX_C_SOURCE=199309L 				-D_POSIX_SOURCE -D_XOPEN_SOURCE 				-D_BSD_SOURCE
-D_SVID_SOURCE 				 -D_GNU_SOURCE 				 -DSHAPE -DXINPUT -DXKB -DLBX
-DXAPPGROUP 	-DXCSECURITY -DTOGCUP  	-DXF86BIGFONT -DDPMSExtension 	 -DPIXPRIV
-DPANORAMIX 	 -DRENDER -DRANDR 	-DXFIXES -DDAMAGE -DCOMPOSITE -DXEVIE 	
-DGCCUSESGAS -DAVOID_GLYPHBLT -DPIXPRIV -DSINGLEDEPTH 				-DXFreeXDGA
-DXvExtension 				-DXFree86LOADER  -DXFree86Server 				-DXF86VIDMODE 			
-DXvMCExtension 				-DSMART_SCHEDULE 				-DBUILDDEBUG -DXResExtension 			
-DX_BYTE_ORDER=X_LITTLE_ENDIAN 				-DXORG_VERSION_CURRENT="(((6) * 10000000) +
((8) * 100000) + ((1) * 1000) + 99)" -D_XSERVER64 -DJENSEN_SUPPORT -DNDEBUG  
-DFUNCPROTO=15 -DNARROWPROTO  -DIN_MODULE -DXFree86Module     	-DGLXEXT
-DXF86DRI -DGLX_DIRECT_RENDERING -DGLX_USE_DLOPEN -DGLX_USE_MESA -D__GLX_ALIGN64
-mieee    -c radeon_probe.c
In file included from radeon_probe.c:52:
radeon_chipset.h:1: error: static declaration of 'RADEONChipsets' follows
non-static declaration
radeon_probe.h:144: error: previous declaration of 'RADEONChipsets' was here
radeon_probe.c:153: warning: type qualifiers ignored on function return type
radeon_probe.c:153: warning: no previous prototype for 'getRADEONEntityIndex'
make[7]: *** [radeon_probe.o] Error 1

[...]

gcc -O2 -ansi -pedantic -Wall -Wpointer-arith -Wstrict-prototypes 			 
-Wmissing-prototypes -Wmissing-declarations 			  -Wredundant-decls
-Wnested-externs -Wundef   -fno-merge-constants -I. -I../i2c
-I../../../../../../programs/Xserver/hw/xfree86/common
-I../../../../../../programs/Xserver/hw/xfree86/os-support
-I../../../../../../programs/Xserver/hw/xfree86           
-I../../../../../../programs/Xserver/hw/xfree86/vbe
-I../../../../../../programs/Xserver/hw/xfree86/int10           
-I../../../../../../programs/Xserver/hw/xfree86/ddc
-I../../../../../../programs/Xserver/hw/xfree86/i2c           
-I../../../../../../programs/Xserver/hw/xfree86/rac
-I../../../../../../programs/Xserver/hw/xfree86/ramdac           
-I../../../../../../programs/Xserver/hw/xfree86/shadowfb
-I../../../../../../programs/Xserver/hw/xfree86/xaa           
-I../../../../../../programs/Xserver/hw/xfree86/xf4bpp
-I../../../../../../programs/Xserver/hw/xfree86/xf1bpp           
-I../../../../../../programs/Xserver/hw/xfree86/vgahw
-I../../../../../../programs/Xserver/hw/xfree86/fbdevhw           
-I../../../../../../programs/Xserver/mfb -I../../../../../../programs/Xserver/fb
-I../../../../../../programs/Xserver/mi           
-I../../../../../../programs/Xserver/miext/shadow           
-I../../../../../../programs/Xserver/render
-I../../../../../../programs/Xserver/Xext
-I../../../../../../programs/Xserver/include           
-I../../../../../../programs/Xserver/GL/dri -I../../../../../../lib/GL/dri
-I../../../../../../include               -I../../../../../../extras/drm/shared
-I../../../../../../include/fonts -I../../../../../../include/extensions
-I../../../../../../exports/include/X11  -I../../../../../..
-I../../../../../../exports/include   -Dlinux -D__alpha__
-D_POSIX_C_SOURCE=199309L 				-D_POSIX_SOURCE -D_XOPEN_SOURCE 				-D_BSD_SOURCE
-D_SVID_SOURCE 				 -D_GNU_SOURCE 				 -DSHAPE -DXINPUT -DXKB -DLBX
-DXAPPGROUP 	-DXCSECURITY -DTOGCUP  	-DXF86BIGFONT -DDPMSExtension 	 -DPIXPRIV
-DPANORAMIX 	 -DRENDER -DRANDR 	-DXFIXES -DDAMAGE -DCOMPOSITE -DXEVIE 	
-DGCCUSESGAS -DAVOID_GLYPHBLT -DPIXPRIV -DSINGLEDEPTH 				-DXFreeXDGA
-DXvExtension 				-DXFree86LOADER  -DXFree86Server 				-DXF86VIDMODE 			
-DXvMCExtension 				-DSMART_SCHEDULE 				-DBUILDDEBUG -DXResExtension 			
-DX_BYTE_ORDER=X_LITTLE_ENDIAN 				-DXORG_VERSION_CURRENT="(((6) * 10000000) +
((8) * 100000) + ((1) * 1000) + 99)" -D_XSERVER64 -DJENSEN_SUPPORT -DNDEBUG  
-DFUNCPROTO=15 -DNARROWPROTO  -DIN_MODULE -DXFree86Module     	-DGLXEXT
-DXF86DRI -DGLX_DIRECT_RENDERING -DGLX_USE_DLOPEN -DGLX_USE_MESA -D__GLX_ALIGN64
-mieee    -c radeon_driver.c
In file included from radeon_driver.c:98:
radeon_chipset.h:1: error: static declaration of 'RADEONChipsets' follows
non-static declaration
radeon_probe.h:144: error: previous declaration of 'RADEONChipsets' was here
radeon_driver.c: In function 'RADEONGetClockInfo':
radeon_driver.c:1485: warning: format '%ld' expects type 'long int', but
argument 6 has type 'CARD32'
radeon_driver.c:1485: warning: format '%ld' expects type 'long int', but
argument 7 has type 'CARD32'
make[7]: *** [radeon_driver.o] Error 1

The correct thing is perhaps:

--- programs/Xserver/hw/xfree86/drivers/ati/radeon_probe.h~     2004-08-03
11:38:03.000000000 +0200
+++ programs/Xserver/hw/xfree86/drivers/ati/radeon_probe.h      2004-11-18
20:01:49.000000000 +0100
@@ -146,9 +146,6 @@
 extern Bool                 RADEONProbe
                            FunctionPrototype((DriverPtr, int));
 
-extern SymTabRec            RADEONChipsets[];
-extern PciChipsets          RADEONPciChipsets[];
-
 /* radeon_driver.c */
 extern void                 RADEONLoaderRefSymLists
                            FunctionPrototype((void));
Comment 2 Adam Jackson 2004-12-15 10:45:51 UTC
roland, this is the xprint issue i was talking about.

i'll take care of the radeon bug.
Comment 3 Roland Mainz 2005-01-18 15:59:12 UTC
ajax wrote:
> roland, this is the xprint issue i was talking about.
> i'll take care of the radeon bug.

That problem has been fixed with bug 2254...
... are there any issues left or can this bug now be closed ?
Comment 4 Falk Hueffner 2005-01-19 00:18:00 UTC
(In reply to comment #3)

> ... are there any issues left or can this bug now be closed ?

There's one left:

Index: programs/Xserver/cfb/cfbgc.c
===================================================================
RCS file: /cvs/xorg/xc/programs/Xserver/cfb/cfbgc.c,v
retrieving revision 1.3
diff -u -p -r1.3 cfbgc.c
--- programs/Xserver/cfb/cfbgc.c        14 Jan 2005 08:37:30 -0000      1.3
+++ programs/Xserver/cfb/cfbgc.c        19 Jan 2005 07:43:01 -0000
@@ -85,7 +85,7 @@ SOFTWARE.
 # define usePolyGlyphBlt       miPolyGlyphBlt
 #endif
 
-void cfbUnPushPixels (GCPtr, PixmapPtr, DrawablePtr, int, int, int, int);
+static void cfbUnPushPixels (GCPtr, PixmapPtr, DrawablePtr, int, int, int, int);
 
 #ifdef FOUR_BIT_CODE
 # define usePushPixels cfbPushPixels8

(maybe there's more, I compiled only ati...)
Comment 5 Adam Jackson 2005-01-19 08:37:18 UTC
(In reply to comment #4)
> (In reply to comment #3)
> 
> > ... are there any issues left or can this bug now be closed ?
> 
> There's one left:
> 
> Index: programs/Xserver/cfb/cfbgc.c

good catch.  note that this one is only relevant to HEAD.
Comment 6 Adam Jackson 2005-04-14 10:53:56 UTC
fixed in HEAD, thanks.
Comment 7 Gary Weasel 2006-11-03 08:41:10 UTC
Hello,

I'm getting the same problem that Falk was, only I'm trying to compile the X
Server with GCC 4.1.  I've downloaded what I've thought is the most recent
source for the 6.8.1 X Server.

Can someone help point me in the right direction to some newer source code or
could this still be an actual bug when compiling with GCC 4.1?
Comment 8 Daniel Stone 2007-02-27 01:24:45 UTC
Sorry about the phenomenal bug spam, guys.  Adding xorg-team@ to the QA contact so bugs don't get lost in future.
Comment 9 George - 2007-03-09 10:34:29 UTC
Should be fixed in head.

Latest X server release is 7.2:

http://ftp.x.org/pub/individual/xserver/xorg-server-1.2.0.tar.bz2

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.