VA_DECL/VA_END usage
Make the variadic functions look more like ordinary code rather than
have the function opening brace be hidden inside the VA_DECL() macro.
That brace is still there, but VA_DECL() now needs to be followed by
a visible brace (which introduces a nested block rather than the
start of the funciton). VA_END() now provides a hidden closing brace
to end the nested block, and the existing closing brace still matches
the one in VA_DECL().
Sample usage:
void foo VA_DECL(int, arg) --macro expansion has a hidden opening brace
{ --new, explicit opening brace (actually introduces a nested block)
VA_START(bar);
...code for foo...
VA_END(); --expansion now provides a closing brace for the nested block
} --existing closing brace, still pairs with the hidden one in VA_DECL()
This should help if/when another round of reformatting ever takes place,
and also with editors or other tools that do brace/bracket/parenthesis
matching.
I had forgotten that there were variadic functions in sys/* and ended
up modifying a lot more files than intended. The majority of changes
to those just inserted a new '{' line so that revised VA_END()'s '}'
won't introduce a syntax error. A couple of them needed VA_END() moved
so that local variables wouldn't go out of scope too soon. Only the
Unix ones have been tested.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.6 amiwind.c $NHDT-Date: 1431192783 2015/05/09 17:33:03 $ $NHDT-Branch: master $:$NHDT-Revision: 1.8 $ */
|
||||
/* NetHack 3.6 amiwind.c $NHDT-Date: 1431737059 2015/05/16 00:44:19 $ $NHDT-Branch: master $:$NHDT-Revision: 1.9 $ */
|
||||
/* NetHack 3.6 amiwind.c $Date: 2009/05/06 10:48:30 $ $Revision: 1.5 $ */
|
||||
/* SCCS Id: @(#)amiwind.c 3.5 2000/01/12
|
||||
/* Copyright (c) Olaf Seibert (KosmoSoft), 1989, 1992 */
|
||||
@@ -889,6 +889,7 @@ amii_loadlib(void)
|
||||
/*VARARGS1*/
|
||||
void error
|
||||
VA_DECL(const char *, s)
|
||||
{
|
||||
VA_START(s);
|
||||
VA_INIT(s, char *);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user