mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2025-02-26 07:31:33 +01:00
Add a macro for the fairly common "eat next semicolon" syntax trick
You use this when you're defining a macro to be used at file scope, and you want to require a semicolon afterwards.
This commit is contained in:
parent
0944500a8e
commit
56bda7464f
1 changed files with 12 additions and 0 deletions
|
@ -217,4 +217,16 @@
|
||||||
/** Macro: Yields the number of elements in array x. */
|
/** Macro: Yields the number of elements in array x. */
|
||||||
#define ARRAY_LENGTH(x) ((sizeof(x)) / sizeof(x[0]))
|
#define ARRAY_LENGTH(x) ((sizeof(x)) / sizeof(x[0]))
|
||||||
|
|
||||||
|
/**
|
||||||
|
* "Eat" a semicolon that somebody puts at the end of a top-level macro.
|
||||||
|
*
|
||||||
|
* Frequently, we want to declare a macro that people will use at file scope,
|
||||||
|
* and we want to allow people to put a semicolon after the macro.
|
||||||
|
*
|
||||||
|
* This declaration of a struct can be repeated any number of times, and takes
|
||||||
|
* a trailing semicolon afterwards.
|
||||||
|
**/
|
||||||
|
#define EAT_SEMICOLON \
|
||||||
|
struct dummy_semicolon_eater__
|
||||||
|
|
||||||
#endif /* !defined(TOR_COMPAT_H) */
|
#endif /* !defined(TOR_COMPAT_H) */
|
||||||
|
|
Loading…
Add table
Reference in a new issue