Skip to contentSkip to conversation

glibc: Inconsistencies in pre-processing of option-groups.h

DISCUSSION Juro Bystricky 1 participant 1 message Nov 22, 2014

lore
Share & tools
lore
#0 lore raw

There are some inconsistencies when processing eglibc options. "option-groups.h" is generated automatically, and to quote:

"It defines macros that indicate which EGLIBC option groups were
configured in 'option-groups.config' when this C library was built. For each option group named OPTION_foo, it #defines __OPTION_foo to be 1 if the group is enabled, or leaves that symbol undefined if the group is disabled."

So for example, one of the following may be generared:

#define __OPTION_XXX 1

or

/* undef __OPTION_XXX */

However, the glibc headers are preprocessed inconsistently, sometimes using:

#ifdef __OPTION_XXX
...

and sometimes

#if __OPTION_XXX
...

The latter case will result in many compiler warning for options that are not defined. This is quite evident when building poky-tiny, where many options are disabled. (This warning will be treated as errors in future releases of glibc.)

To fix these inconsistencies, there are two solutions:

One solution would be to generate

#define __OPTION_XXX 0

instead of

/* undef __OPTION_XXX */

In this case all preprocessing tests can use/should use

#if __OPTION_XXX
...

Second solution would be to leave generation of option-groups.h as it is, but in this case all occurrences of

#if __OPTION_XXX

should be consistently replaced everywhere by

#ifdef __OPTION_XXX

Juro