My Oracle Support Banner

Wrong Macro Definitions Parsing When The -D Compiler Option Is Used In "cc" (Doc ID 2667047.1)

Last updated on MAY 12, 2020

Applies to:

Oracle Solaris Studio - Version 12.3 to 12.6 [Release 12]
Information in this document applies to any platform.

Symptoms

A C source code file has the following code

ACTUAL BEHAVIOR
---------------
When using the -D option at "cc" command line an unexpected space is added.

This behavior happens only with "cc", not "CC".
This happens with all Oracle Solaris/Developer Studio releases from 12.3 to 12.6.
It appears that this space insertion happens when the string starts with a digit, and contains underscores (_) or hyphens (-).
There might also be other combinations.

EXPECTED BEHAVIOR
-----------------------
The pre-processing made by "cc" should be consistent no matter if -D option is used or not and no space should be added.

STEPS
-----------------------

The issue can be reproduced at will with the following steps:

0. Save the above code in a file named "test.c";

1. run the following command

# cc -E test.c
char * version_1_8_27 = "Version Def";

No space is added.

2. run the following command

# cc -E test.c -DVERSION=1_8_27
char * version_1 _8_27 = "Version Def";

A space has been added, after "version_1".

Changes

 

Cause

To view full details, sign in with your My Oracle Support account.

Don't have a My Oracle Support account? Click to get started!


In this Document
Symptoms
Changes
Cause
Solution
References


My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.