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

XMLWordPrintable

    • Type: Bug
    • Resolution: Unresolved
    • Priority: 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.

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

              Created:
              Updated:

                Connection: Intermediate to External PROD System
                EXTSYNC-3778 - _Pragma("diag_suppress 179") has no...
                SYNCHRONIZED
                • Last Sync Date: