flagging implicit function declarations as errors (was: [PATCH] pci: Restore pciTag as a deprecated function)

Alan Coopersmith alan.coopersmith at oracle.com
Thu Oct 20 15:22:07 PDT 2011


On 10/19/11 23:45, Jamey Sharp wrote:
> On Wed, Oct 19, 2011 at 10:47:17AM -0700, Jeremy Huddleston wrote:
>> I think we coddled the drivers enough with the current set of
>> just-deprecations.  This is too trivial.  I'll just go through and
>> make sure nobody is actually using it because drivers still build
>> "successfully" due to us not using
>> -Werror=implicit-function-declaration
>>
>> Perhaps we should add -Werror=implicit-function-declaration to all the
>> drivers...
>
> Any reason not to add it to xorg-macros, and get the equivalents for Sun
> Studio and clang in too? I think it should be safe to say that every
> instance of an implicit function declaration anywhere in X.Org is a bug.

For Sun Studio, the flag to turn implicit declarations from warnings to
errors is -errwarn=E_NO_IMPLICIT_DECL_ALLOWED .
	
alanc at also:/tmp [3:12pm - 13] cat test.c
int main()
{
     printf("Hello");
}

alanc at also:/tmp [3:12pm - 14] cc -c test.c
"test.c", line 3: warning: implicit function declaration: printf

alanc at also:/tmp [3:12pm - 15] cc -errwarn=E_NO_IMPLICIT_DECL_ALLOWED -c test.c
"test.c", line 3: implicit function declaration: printf
cc: acomp failed for test.c

In the quick testing I did, it seems to work back to at least Studio 8 (current
version is 12.2, with 12.3 in beta now), and seems to just cause extra unknown
flag warnings on earlier versions, doesn't cause compiles to fail, so should be
safe to add to the default flags for Studio.

I do see some warnings in build logs that it would turn into errors, and they
all seem to be in drivers, and frankly, only the first two of them do I really
care about:

"radeon_accel.c", line 433: warning: implicit function declaration: 
drmCommandWriteRead
"mga_driver.c", line 3816: warning: implicit function declaration: xf86ModeBandwidth
"mga_vga.c", line 65: warning: implicit function declaration: usleep
"vmodes.c", line 257: warning: implicit function declaration: usleep
"s3_Ti.c", line 446: warning: implicit function declaration: usleep
"s3v_accel.c", line 334: warning: implicit function declaration: usleep
"sis_driver.c", line 9325: warning: implicit function declaration: 
miPointerAbsoluteCursor
"voodoo_driver.c", line 898: warning: implicit function declaration: 
VoodooRestorePassThrough
"xgi_cursor.c", line 241: warning: implicit function declaration: 
vWaitCRT1VerticalRetrace
"xgi_cursor.c", line 242: warning: implicit function declaration: XGIDumpMMIO
"xgi_driver.c", line 507: warning: implicit function declaration: LoaderRefSymLists
"xgi_driver.c", line 655: warning: implicit function declaration: XGISetDPMS
"xgi_driver.c", line 1616: warning: implicit function declaration: bGetEDID
"xgi_driver.c", line 1684: warning: implicit function declaration: 
xf86LoaderReqSymLists
"xgi_driver.c", line 2950: warning: implicit function declaration: open
"xgi_driver.c", line 4484: warning: implicit function declaration: 
Volari_SetDefaultIdleWait
"xgi_driver.c", line 4643: warning: implicit function declaration: XGISetModeNew
"xgi_setup.c", line 638: warning: implicit function declaration: XGI_New_GetVBType


-- 
	-Alan Coopersmith-        alan.coopersmith at oracle.com
	 Oracle Solaris Platform Engineering: X Window System



More information about the xorg-devel mailing list