mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2026-11-16 19:04:53 +08:00
cpukit/include/rtems/confdefs: Improved comments on #pragmas section
- Added a description to the _CONFIGURE_ASSERT_NOT_NULL() macro definition in doxygen format. - Improved comment section above the #pragmas to ignore warnings. Updates #4831.
This commit is contained in:
1 parent
4400e4521f
commit
9b8e36803b
2 files changed
+23
-2
No files matched your search
@@ -46,6 +46,17 @@
|
||||
|
||||
#ifdef CONFIGURE_INIT
|
||||
|
||||
/**
|
||||
* @brief Asserts at compile-time that the value is not NULL.
|
||||
*
|
||||
* This macro validates that the given value is not NULL. If the value is
|
||||
* non-NULL, it is returned unchanged. Otherwise, a compile-time error is
|
||||
* triggered by using an invalid array bound.
|
||||
*
|
||||
* When _value is a function symbol, the compiler may prove that its address
|
||||
* is never NULL and reports the comparison as tautological. This assertion may
|
||||
* trigger warnings (for example, -Waddress and -Wtautological-pointer-compare).
|
||||
*/
|
||||
#define _CONFIGURE_ASSERT_NOT_NULL( _type, _value ) \
|
||||
( ( _value ) != NULL \
|
||||
? ( _value ) \
|
||||
@@ -100,12 +111,17 @@ extern const char *bsp_boot_cmdline;
|
||||
|
||||
/*
|
||||
* Ignore the following warnings from g++ and clang in the uses of
|
||||
* _CONFIGURE_ASSERT_NOT_NULL() below:
|
||||
* _CONFIGURE_ASSERT_NOT_NULL() because they are a by-product of the
|
||||
* assertion and not a real defect. See examples below:
|
||||
*
|
||||
* warning: the address of 'void Init()' will never be NULL [-Waddress]
|
||||
*
|
||||
* warning: comparison of function 'Init' not equal to a null pointer is always
|
||||
* true [-Wtautological-pointer-compare]
|
||||
*
|
||||
* Additionally, -Wpragmas is suppressed since some compilers may not support
|
||||
* every warning option named below, which maintains compatibility across
|
||||
* different compilers without causing unnecessary warnings.
|
||||
*/
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Waddress"
|
||||
|
||||
@@ -167,12 +167,17 @@ const uintptr_t _Stack_Space_size = _CONFIGURE_STACK_SPACE_SIZE;
|
||||
defined( CONFIGURE_TASK_STACK_DEALLOCATOR )
|
||||
/*
|
||||
* Ignore the following warnings from g++ and clang in the uses of
|
||||
* _CONFIGURE_ASSERT_NOT_NULL() below:
|
||||
* _CONFIGURE_ASSERT_NOT_NULL() because they are a by-product of the
|
||||
* assertion and not a real defect. See examples below:
|
||||
*
|
||||
* warning: the address of 'f()' will never be NULL [-Waddress]
|
||||
*
|
||||
* warning: comparison of function 'f' not equal to a null pointer is always
|
||||
* true [-Wtautological-pointer-compare]
|
||||
*
|
||||
* Additionally, -Wpragmas is suppressed since some compilers may not support
|
||||
* every warning option named below, which maintains compatibility across
|
||||
* different compilers without causing unnecessary warnings.
|
||||
*/
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Waddress"
|
||||
|
||||
Reference in new issue
Block a user