Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

correct handling of # in preprocessor #2528

Merged
merged 1 commit into from
May 20, 2023

Conversation

guwirth
Copy link
Collaborator

@guwirth guwirth commented May 19, 2023

  • Check if # is the first token in the line, only then it is a preprocessor command. Otherwise it is a special character which is treated e.g. in macros like any other string.
  • close sonar-scanner hangs with sonar-sxx 2.1 #2505

Sample:

BOOST_PP_EXPAND(#) ifndef BOOST_FT_config_valid
BOOST_PP_EXPAND(#)   define BOOST_FT_cc_id 1
BOOST_PP_EXPAND(#)   define BOOST_FT_cc_name implicit_cc
BOOST_PP_EXPAND(#)   define BOOST_FT_cc BOOST_PP_EMPTY
BOOST_PP_EXPAND(#)   define BOOST_FT_cond callable_builtin
#define _()
BOOST_PP_EXPAND(#)   include BOOST_FT_cc_file
#undef _
BOOST_PP_EXPAND(#)   undef BOOST_FT_cond
BOOST_PP_EXPAND(#)   undef BOOST_FT_cc_name
BOOST_PP_EXPAND(#)   undef BOOST_FT_cc
BOOST_PP_EXPAND(#)   undef BOOST_FT_cc_id
BOOST_PP_EXPAND(#) else
BOOST_PP_EXPAND(#)   undef BOOST_FT_config_valid
BOOST_PP_EXPAND(#) endif

This change is Reviewable

@guwirth guwirth added the bug label May 19, 2023
@guwirth guwirth added this to the 2.1.1 milestone May 19, 2023
@guwirth guwirth self-assigned this May 19, 2023
Check if # is the first token in the line, only then it is a preprocessor command. Otherwise it is a special character which is treated e.g. in macros like any other string.
@guwirth guwirth merged commit 5663bbb into SonarOpenCommunity:master May 20, 2023
@guwirth guwirth deleted the fix-2505 branch June 7, 2023 12:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

sonar-scanner hangs with sonar-sxx 2.1
1 participant