[RTEMS Project] #4831: #pragmas to ignore warnings

RTEMS trac trac at rtems.org
Fri Jan 27 19:13:02 UTC 2023


#4831: #pragmas to ignore warnings
---------------------------+---------------------
 Reporter:  Daniel Páscoa  |       Owner:  (none)
     Type:  defect         |      Status:  new
 Priority:  normal         |   Milestone:
Component:  admin          |     Version:
 Severity:  normal         |  Resolution:
 Keywords:                 |  Blocked By:
 Blocking:                 |
---------------------------+---------------------

Comment (by Sebastian Huber):

 The comment and pragma list is
 {{{#!c
 /*
  * Ignore the following warnings from g++ and clang in the uses of
  * _CONFIGURE_ASSERT_NOT_NULL() 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]
  */
 #pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-Waddress"
 #pragma GCC diagnostic ignored "-Wpragmas"
 #pragma GCC diagnostic ignored "-Wtautological-pointer-compare"
 }}}
 The name of the macro `_CONFIGURE_ASSERT_NOT_NULL` suggests that it
 asserts that the parameter is not NULL. So, if you have a non-NULL
 parameter, everything is fine. However, in this case you get the warnings.
 So, these warnings are disabled by the pragmas. What is the problem?

--
Ticket URL: <http://devel.rtems.org/ticket/4831#comment:1>
RTEMS Project <http://www.rtems.org/>
RTEMS Project


More information about the bugs mailing list