This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

how to suppress one instance of a warning/remark?

I would like to suppress one particular instance of a warning/remark. How can I do this? The usual method is with some #pragma, but I don't see it. SPRU514C says on p. 39:

--diag_error=num Categorizes the diagnostic identified by num as an error. To determine the
numeric identifier of a diagnostic message, use the --display_error_number
option first in a separate compile. Then use --diag_error=num to recategorize
the diagnostic as an error. You can only alter the severity of discretionary
diagnostics.

--diag_remark=num Categorizes the diagnostic identified by num as a remark. To determine the
numeric identifier of a diagnostic message, use the --display_error_number
option first in a separate compile. Then use --diag_remark=num to
recategorize the diagnostic as a remark. You can only alter the severity of
discretionary diagnostics.

--diag_suppress=num Suppresses the diagnostic identified by num. To determine the numeric
identifier of a diagnostic message, use the --display_error_number option first
in a separate compile. Then use --diag_suppress=num to suppress the
diagnostic. You can only suppress discretionary diagnostics.

--diag_warning=num Categorizes the diagnostic identified by num as a warning. To determine the
numeric identifier of a diagnostic message, use the --display_error_number
option first in a separate compile. Then use --diag_warning=num to
recategorize the diagnostic as a warning. You can only alter the severity of
discretionary diagnostics.

but these options apply for the whole file.

  • The pragmas you are looking for are in the C2000 tools from v4.1.0 (Mar 2005) and later.

    The following is an excerpt from the 4.1.0 Release Notes, but the information does not appear to have made it into the release of the manual you refer to (SPRU514C) even though it was published in 2007.

    ------------------------------------------------------------------------------
    1.16. Pragmas to Control Diagnostic Messages
    ------------------------------------------------------------------------------
    The following pragmas may be used to control diagnostic messages in the same
    ways as the corresponding command line options:

      pragma                     option      meaning

      #pragma diag_suppress id   -pds=id     Suppress diagnostic <id>
      #pragma diag_remark   id   -pdsr=id    Treat diagnostic <id> as a remark
      #pragma diag_warning  id   -pdsw=id    Treat diagnostic <id> as a warning
      #pragma diag_error    id   -pdse=id    Treat diagnostic <id> as an error

      #pragma diag_default  id   N/A         Use default severity of the diagnostic

    The pragma syntax is the following:
      #pragma diag_xxx [=] error_number_or_tag, error_number_or_tag ...

    The diagnostic affected is specified using either an error number or an error
    tag name. The "=" is optional. Any diagnostic may be overridden to be an error,
    but only diagnostics with a severity of discretionary error or below may have
    their severity reduced to a warning or below, or be suppressed. The
    diag_default pragma is used to return the severity of a diagnostic to the one
    that was in effect before any pragmas were issued (i.e., the normal severity of
    the message as modified by any command-line options).

    The diagnostic identifier number is output along with the message when the
    -pden command line option is specified.

  • also FWIW the list of error/warning/remark msgs can be found on the link shown in the wiki page http://processors.wiki.ti.com/index.php/C28x_Compiler_Error_and_Warning_Messages