gcc alternate keywords and kernel source

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



  from the gcc manual
(http://gcc.gnu.org/onlinedocs/gcc-4.1.2/gcc/Alternate-Keywords.html#Alternate-Keywords):

"-ansi and the various -std options disable certain keywords. This
causes trouble when you want to use GNU C extensions, or a
general-purpose header file that should be usable by all programs,
including ISO C programs. The keywords asm, typeof and inline are not
available in programs compiled with -ansi or -std (although inline can
be used in a program compiled with -std=c99). The ISO C99 keyword
restrict is only available when -std=gnu99 (which will eventually be
the default) or -std=c99 (or the equivalent -std=iso9899:1999) is
used."

"The way to solve these problems is to put `__' at the beginning and
end of each problematical keyword. For example, use __asm__ instead of
asm, and __inline__ instead of inline. "

  what this tells me (and CMIIW) is that one need only use the "__"
variations in kernel source that is being exported to userspace, yes?
that is, in the same way that using "__u32" instead of just "u32" is
only *necessary* under the same circumstances.

  so while it's not, technically speaking, *wrong*, it's not necessary
to have used that longer variation in, say, net/packet/af_packet.c:

#define XC(a, b) ({ __typeof__ ((a)) __t; __t = (a); (a) = (b); __t;
})

since that's a source file and there's no way that would have made it
to userspace anyway.  do i understand that correctly?

rday

-- 
========================================================================
Robert P. J. Day
Linux Consulting, Training and Annoying Kernel Pedantry
Waterloo, Ontario, CANADA

http://fsdev.net/wiki/index.php?title=Main_Page
========================================================================

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux