1. Description
If a function-like macro statement is made which extends over more than
one line and uses comment statements beginning with // or enclosed with
/* and */, the following error message may be dispatched during
compilation:
error: unterminated comment
2. Conditions
This problem may occur if the following conditions are all satisfied:
(1) A function-like macro is stated extending over more than one line.
(2) In the ending line of the macro in (1), a comment statement
beginning with // or enclosed with /* and */ is placed.
(3) In the line immediately before the line in (2), another comment
statement beginning with // is placed.
(4) The size of the C source file concerned is greater than 512 bytes.
Note that the size includes that of the include files if they are.
3. Example
-------------------------------------------------------------------------
#define SAMPLE_MACRO(a,b,c) (a + b + c)
/* This program part omitted */
int func(void)
{
return SAMPLE_MACRO( 1,
2, // No.2 <-- Conditions (1) and (3)
3); // No.3 <-- Conditions (1) and (2)
}
-------------------------------------------------------------------------
In the above example, the problem may not arise depending on the
descriptions of the omitted program part.
4. Workarounds
Delete the comment statement in Condition (3), which begins with //,
or change it to the one enclosed with /* and */.
Example:
return SAMPLE_MACRO( 1,
2, /* No.2 */ <-- Enclosed with /* and */
3); // No.3