forked from Mirror/frr
build: enable -fms-extensions
This eases incorporating fields from/"subclassing" another struct. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
This commit is contained in:
parent
5b4f4e626f
commit
3f115705d3
14
configure.ac
14
configure.ac
|
@ -330,7 +330,21 @@ LDFLAGS="$LDFLAGS -g"
|
|||
|
||||
AM_CONDITIONAL([DEV_BUILD], [test "$enable_dev_build" = "yes"])
|
||||
|
||||
dnl -fms-extensions causes clang to have a built-in __wchar_t on OpenBSD,
|
||||
dnl which just straight up breaks compiling any code.
|
||||
dnl (2022-04-04 / OpenBSD 7 / clang 11.1.0)
|
||||
AH_VERBATIM([OpenBSD], [
|
||||
#ifdef __OpenBSD__
|
||||
#define __wchar_t __wchar_t_ignore
|
||||
#include <stdint.h>
|
||||
#undef __wchar_t
|
||||
#endif
|
||||
])
|
||||
|
||||
dnl always want these CFLAGS
|
||||
AC_C_FLAG([-fms-extensions], [
|
||||
AC_MSG_ERROR([$CC does not support unnamed struct fields (-fms-extensions)])
|
||||
])
|
||||
AC_C_FLAG([-fno-omit-frame-pointer])
|
||||
AC_C_FLAG([-funwind-tables])
|
||||
AC_C_FLAG([-Wall])
|
||||
|
|
|
@ -897,6 +897,26 @@ necessary replacements.
|
|||
| u_long | unsigned long |
|
||||
+-----------+--------------------------+
|
||||
|
||||
FRR also uses unnamed struct fields, enabled with ``-fms-extensions`` (cf.
|
||||
https://gcc.gnu.org/onlinedocs/gcc/Unnamed-Fields.html). The following two
|
||||
patterns can/should be used where contextually appropriate:
|
||||
|
||||
.. code-block:: c
|
||||
|
||||
struct outer {
|
||||
struct inner;
|
||||
};
|
||||
|
||||
.. code-block:: c
|
||||
|
||||
struct outer {
|
||||
union {
|
||||
struct inner;
|
||||
struct inner inner_name;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
.. _style-exceptions:
|
||||
|
||||
Exceptions
|
||||
|
|
Loading…
Reference in a new issue