View Single Post
  #8   (View Single Post)  
Old 27th August 2008
BSDfan666 BSDfan666 is offline
Real Name: N/A, this is the interweb.
Banned
 
Join Date: Apr 2008
Location: Ontario, Canada
Posts: 2,223
Default

The warning messages printed at compile time, are not a GCC modification, it's simply a frequently unused feature of the GNU linker.

Code:
#include <stdio.h>

__warn_references(printf, "Are you using printf????? Yay!!");

int
main(int argc, char **argv) {
	printf("This is a simplistic, unusual program.\n");
}
Results:
Code:
$ gcc example.c -o example
/tmp//ccw21238.o(.text+0x21): In function `main':
: Are you using printf????? Yay!!
$
The function is defined in <cdefs.h>, which is pulled in by <stdio.h>.
Reply With Quote