On Mon, May 30, 2005 at 02:49:21PM +0200, Moritz Grimm wrote:

> 
> trying to compile a program of mine on FreeBSD that needs to figure out 
> the value of PF_TABLE_NAME_SIZE from pfvar.h fails with the following 
> errors:
> 
> line 368:34: "not" may not appear in macro parameter list
> line 396: unexpected unqualified-id before `!' token
> 
> I can't make heads or tails out of those, and it works just fine on 
> OpenBSD (3.6 to -current). It may be worth noting that my program is 
> written in C++ and that FBSD's compiler is 3.4.something (.2, iirc).

'not' is a reserved keyword in C++, but not in C. Some variables in
pfvar.h were named 'not' in pfvar.h, before this was first reported.
They have been changed to 'neg' subsequently, and this change has made
it into FreeBSD, too.

If you can, update FreeBSD (to 5.4). If that's not possible, you can
manually merge the rename in your source. Basically, replace struct
pf_rule_addr's member 'not' to 'neg', then go through pf.c (and
pf_ioctl.c, IIRC) and rename uses where needed.

PF_TABLE_NAME_SIZE will probably not vary across OSs, but it might
change at some point in the future.

If your code must be able to extract the value on a pre-rename system,
you might have to

  a) extract the #define PF_TABLE_NAME_SIZE line through some configure
     script hackery (grep)

  b) compile a C module which #includes pfvar.h and exports an integer
     initialized to the value, then link that to your C++ program

Daniel

Reply via email to