[haiku-development] Re: GNU awk fails to build

  • From: François Revol <revol@xxxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Sat, 20 Aug 2016 18:09:36 +0200

On 20/08/2016 17:36, Adrien Destugues wrote:

Hi,

GNU awk currently fails to build in an interesting way. I'm not sure
who's at fault.

Basically, it does this:

#define param something.with.dots
#include <pthreads.h>

Our pthreads.h uses "param" as a parameter name (for
pthread_attr_setschedparams). It is expanded using awk's define, and the
result isn't valid C.

Possible solutions:
- Rename or remove the parameter name in pthread.h to avoid the problem,
- Have awk include the header before #defining its things.

I'm not sure if patching awk is justified here - what is there to
prevent them from doing this? (C standard? can't think of anything
there?). But I don't think patching Haiku to avoid the problem is the
right thing to do either.


We often have warnings about names shadowing parameters (like 'time') also.

Standards say only names beginning with __ are reserved for the implementation. We probably want to use it for parameters as well, that's what GNU/Linux is doing:

/* Set scheduling parameters (priority, etc) in *ATTR according to PARAM. */
extern int pthread_attr_setschedparam (pthread_attr_t *__restrict __attr,
                                       const struct sched_param *__restrict
                                       __param) __THROW __nonnull ((1, 2));


François.

Other related posts: