Uploaded image for project: 'Embedded Software & Tools'
  1. Embedded Software & Tools
  2. EXT_EP-11103

_Pragma("diag_suppress 179") has no effect when used inside a macro, but works when used outside a macro

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Low Low

      The attached source file has these lines ...

      #define DEFINE_THIS_MODULE_NAME(_name_)                  \
          _Pragma("diag_push")                                 \
          _Pragma("diag_suppress 179")                         \
          static char const g_this_module_name[] = #_name_;    \
          _Pragma("diag_pop")
      
      // Sees diagnostic 179
      DEFINE_THIS_MODULE_NAME(test0)
      
      // Does not see diagnostic 179
      _Pragma("diag_push") _Pragma("diag_suppress 179") static char const also_not_used[] = "test1"; _Pragma("diag_pop")
      

      It uses _Pragma("diag_suppress 179") twice. The first time is from inside a macro. The second time is outside a macro. Build it ...

      % armcl --display_error_number file.c
      "file.c", line 8: warning #179-D: variable "g_this_module_name" was declared but never referenced
      

      The diag_suppress from inside the macro is ignored. The second one, which is the same except for being outside any macro, correctly suppresses the diagnostic.

            syncuser TI User
            syncuser TI User
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: