mirror of
https://github.com/gryf/wmaker.git
synced 2026-01-06 13:54:12 +01:00
WPrefs: created macro 'wlengthof_nocheck' for the cases were wlengthof cannot be used
Because the macro wlengthof preforms a check of validity of its argument with static_assert, there is a use case where it fails with a compiler error. This patch introduces an alternate macro without the check, to be used only for this specific case. To be able to use the size of the array, a few of those array declaration have to be moved before the structure in which their size is used. Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
This commit is contained in:
committed by
Carlos R. Mafra
parent
7d09b2c04f
commit
6ac27ba842
@@ -37,6 +37,20 @@
|
||||
/* Needed for HAVE_LIBINTL_H and EXTENDED_WINDOWSHORTCUT */
|
||||
#include "../src/wconfig.h"
|
||||
|
||||
/*
|
||||
* The macro 'wlengthof' should be used as much as possible, this macro
|
||||
* is reserved for the cases where wlengthof cannot be used because the
|
||||
* static_assert. Typical symptom is this compiler error (gcc):
|
||||
*
|
||||
* error: braced-group within expression allowed only inside a function
|
||||
*
|
||||
* which appears when you try to create an array whose size is determined using
|
||||
* wlengthof on some other array.
|
||||
*/
|
||||
#define wlengthof_nocheck(array) \
|
||||
(sizeof(array) / sizeof(array[0]))
|
||||
|
||||
|
||||
/****/
|
||||
|
||||
extern char *NOptionValueChanged;
|
||||
|
||||
Reference in New Issue
Block a user