Skip to contentSkip to conversation

some questions about generated headers

DISCUSSION Robert P. J. Day 2 participants 2 messages Feb 9, 2008

lore
Share & tools
lore
#0 lore raw

just a few observations about the generated headers and whether
there's some cleanup to be done there.

1)

the generated header linux/tty.h consists solely of:

=====
#ifndef _LINUX_TTY_H
#define _LINUX_TTY_H

/*
* 'tty.h' defines some structures used by tty_io.c and some defines. */

#endif
=====

i once submitted a patch that, if this header were included from
userspace, would print, "Don't include me from user space, I'm empty." or something to that effect. is that worth doing? or should user space code be including that header at all? (should an empty header even be *exported* to user space?)

2)

include/linux/soundcard.h still contains some weird, non-standard
checks:

...
#if (!defined(__KERNEL__) && !defined(KERNEL) && !defined(INKERNEL) && !defined(_KERNEL)) || defined(USE_SEQ_MACROS)
...

so what's with KERNEL or INKERNEL or _KERNEL? do those tests still
have any value? or can they be tossed?

3)

related to 2), what's up with __KERNEL as well? it still shows up
in a number of places in the kernel source. for example, see
include/linux/hdsmart.h:

...
#ifndef __KERNEL
...
#endif /* __KERNEL__ *

(and that missing trailing slash creeps me out, too.)

4)

any chance of replacing the current unifdef with sunifdef (son of
unifdef), which is smarter and can simplify some of the compound logical preprocessor checks to get rid of more junk in those generated headers?

http://www.sunifdef.strudl.org/

that should do for now.

rday
--

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

Home page:                                         http://crashcourse.ca
Fedora Cookbook:    http://crashcourse.ca/wiki/index.php/Fedora_Cookbook

========================================================================

#1 lore raw

On Saturday 09 February 2008, Robert P. J. Day wrote:

[...]

Quoted 6 lines
Quoted 1 line

3)

related to 2), what's up with __KERNEL as well? it still shows up
in a number of places in the kernel source. for example, see
include/linux/hdsmart.h:

Quoted 6 lines

...
#ifndef __KERNEL
...
#endif /* __KERNEL__ *

(and that missing trailing slash creeps me out, too.)

These hdsmart.h goofups are my doings. 8)

[ I must have been half-asleep while making these changes but no harm
for kernel side was done (this file is not used by kernel anymore) and yes, I didn't have motivation to look up for answer to 3) so I've just put fdefs there. ]

Thanks,
Bart