Be more careful when re#defining printf (XCC)
authorBarret Rhoden <brho@cs.berkeley.edu>
Tue, 3 Nov 2015 15:36:26 +0000 (10:36 -0500)
committerBarret Rhoden <brho@cs.berkeley.edu>
Tue, 3 Nov 2015 16:17:50 +0000 (11:17 -0500)
commitb3dc4ab6cc789629ff09cb9287968d7b9866c3c5
treed1281c0ba60b9ea3ce0c14f9ea80dba4b882ce4b
parentfc84e002c8b2fd9d6cc4bf49fffc1dd53913cbba
Be more careful when re#defining printf (XCC)

The problem here was that #defining printf catches all usages of the
word printf.  We only want to #define printf when it is used as a
function.

This popped up when libgomp failed to build, complaining that
"akaros_printf" is not a format function.  What's going on is that
somewhere in libgomp they are doing an __atttribute__ ((format (printf,
1, 2))), which marks a function as a printf-style function.  The word
'printf' in there is getting expanded to akaros_printf, and gcc rejects
that.  (For more info on that, check out
https://gcc.gnu.org/onlinedocs/gcc-3.2/gcc/Function-Attributes.html).

Removing parlib/stdio.h from parlib/common.h wouldn't really fix this.
It would, in the short term, but eventually libgomp would need to
 #include parlib/stdio.h, since it probably will use some 2LS / vcore
feature and want to do a printf.

Rebuild glibc.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
user/parlib/include/stdio.h