ARM Technical Support Knowledge Articles

WARNING 317 (REDEFINITION OF MACRO)

Applies to: C51 C Compiler

Answer


Information in this article applies to:


QUESTION

I'm working on a project that includes nexted header files with multiple identical macro definitions. For example:

#define JJJ 123
#define JJJ 123

These macros are identical, but doesn't the compiler warn about these?

ANSWER

The C51 Compiler only warns you if the macro definitions are different. For example, the following program:

#define JJJ 123
#define JJJ 123
#define JJJ 345

void main (void)
{
}

compiles with the following diagnostics:

stmt level    source

   1          #define JJJ 123
   2          #define JJJ 123
   3          #define JJJ 345
*** WARNING 317 IN LINE 3 OF .main.c: redefinition of macro 'JJJ'
   4
   5          void main (void)
   6          {
   7   1      }
   8
   9

As you can see, no warning is generated for line 2. But, a warning is generated for line 3 since the macro definition is different.

Article last edited on: 2000-10-26 00:00:00

Rate this article

[Bad]
|
|
[Good]
Disagree? Move your mouse over the bar and click

Did you find this article helpful? Yes No

How can we improve this article?

Link to this article
Copyright © 2011 ARM Limited. All rights reserved. External (Open), Non-Confidential