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.

Undefined preprocessing identifier

I use Code Composer Studio v4.2.4.00033 for C2000
processors.

I just enabled the -pdr ("Issue remarks") option on my C2000
compiler and now when it encounters a line in one of my
standard headers:

  #if (defined(MCU) && (MCU == 2812))

C2000 issues the following diagnostic:
  "line 65: remark #195-D: zero used for undefined
  preprocessing identifier"

I have been writing C expressions of this form for 24 years,
using a broad spectrum of compilers (and I teach C++ at a
junior college) under the principle of "short circuit
expression evaluation," i.e. if the subexpression
"defined(MCU)" is false, the whole expression is false, and
subexpression "(MCU == 2812)" is never evaluated.

My belief is backed up by section 2.6 of K&R2.0 (pp. 41-42)
and the ANSI C standard, at least through C99 (sections
6.5.13 bullet 4 and 6.5.14, bullet 4)

In my dialect of C, there is no undefined identifier in this
expression.  Am I missing something?

  • Your description of the handling of && operators is correct.  This is a bug in the compiler.  I filed SDSCM00043643 in the SDOWP system to get this addressed.  Feel free to follow it with the SDOWP link below in my signature.

    Thanks and regards,

    -George

  • On Friday, March 30, 2012 3:41 PM; Georgem wrote:
    >
    > Your description of the handling of && operators is correct.
    > This is a bug in the compiler.
    >
    Thanks for the quick comeback!

    >
    > I filed SDSCM00043643 in the SDOWP system to get this
    > addressed. Feel free to follow it with the SDOWP link below
    > in my signature.
    >
    That link takes me to a window that requires a login and
    password. Choosing the default does not work.

    Also, if this gets fixed, will I have to upgrade to v5 to
    see it?

  • Gary Lynch said:
    That link takes me to a window that requires a login and
    password. Choosing the default does not work.

    I fixed the link.  Please try again.  

    Gary Lynch said:
    Also, if this gets fixed, will I have to upgrade to v5 to
    see it?

    It is possible.  But usually not.  To answer with precision, I need to know the compiler version (not CCS version) you are using now.

    Thanks and regards,

    -George

  • On Monday, April 02, 2012 12:22 PM; Georgem wrote:
    > >
    > > That link takes me to a window that requires a login and
    > > password. Choosing the default does not work.
    >
    > I fixed the link.  Please try again. 
    >
    That worked.  I can see it now.

    > >
    > > Also, if this gets fixed, will I have to upgrade to v5 to
    > > see it?
    >
    > It is possible. But usually not. To answer with precision, I
    > need to know the compiler version (not CCS version) you are
    > using now.
    >
    Using the:
      cl2000 --tool_version

    command, I got the following:
    ]
    ]   TMS320C2000 C/C++ Compiler              v6.0.1
    ]   TMS320C2000 C/C++ Parser                v6.0.1
    ]   TMS320C2000 C/C++ File Merge            v6.0.1
    ]   TMS320C2000 C/C++ Optimizer             v6.0.1
    ]   TMS320C2000 C/C++ Codegen               v6.0.1
    ]   TMS320C2000 Assembler                   v6.0.1
    ]   TMS320C2000 Embed Utility               v6.0.1
    ]   TMS320C2000 C Source Interlister        v6.0.1
    ]   TMS320C2000 Linker                      v6.0.1
    ]   TMS320C2000 Absolute Lister             v6.0.1
    ]   TMS320C2000 Strip Utility               v6.0.1
    ]   TMS320C2000 Post Link Optimizer         v6.0.1
    ]   TMS320C2000 XREF Utility                v6.0.1
    ]   TMS320C2000 C++ Demangler               v6.0.1
    ]   TMS320C2000 Hex Converter               v6.0.1
    ]   TMS320C2000 Library Builder             v6.0.1
    ]   TMS320C2000 Name Utility                v6.0.1
    ]   TMS320C2000 Object File Display         v6.0.1
    ]   TMS320C2000 Archiver                    v6.0.1
    ]

  • Was this issue resolved?  I'm a little rusty, so maybe I'm making a simple mistake, but I saw this post and it makes me wonder...

    I have ccsv5, and I also get the same error although x and y are defined/initialized in another function:

    if (x == y)

    compilation error:

    "remark: zero used for undefined preprocessing identifier"

    It assumes both x and y are zero.

  • Tim Burress said:
    Was this issue resolved?

    No.

    Tim Burress said:
    if (x == y)

    This is a different case than the one mentioned earlier.  The earlier case involves a #if preprocessing expression with the && operator.  This is not a preprocessing expression, and there is no &&.  The compiler is probably right about this diagnostic.  Build with --gen_acp_raw to see the before and after preprocessing expansion of this line.  It will appear in a file with the extension .rl.  I'm thinking the problem will be obvious at that point.

    Thanks and regards,

    -George