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

Cannot parse __has_builtin #2395

Closed
godambrosio opened this issue Jun 15, 2022 · 2 comments · Fixed by #2406
Closed

Cannot parse __has_builtin #2395

godambrosio opened this issue Jun 15, 2022 · 2 comments · Fixed by #2406
Milestone

Comments

@godambrosio
Copy link

godambrosio commented Jun 15, 2022

Describe the bug
The CXX sensor is ignored due to an error: Cannot parse '#if (__has_builtin(__builtin_FILE) and __has_builtin(__builtin_LINE))', ignoring...

To Reproduce
Steps to reproduce the behavior:

  1. Start sonarqube scanner
  2. Build the application
  3. End the sonarqube scanner

Expected behavior
Sensor CXX is executed

Screenshots
Capture

Desktop (please complete the following information):

  • OS: Windows
  • SonarQube version: 8.9.8.54436 Developer Edition
  • cxx plugin version: 2.1 (build 229)
  • sonar-scanner version: 4.6.2.2472
@guwirth
Copy link
Collaborator

guwirth commented Jun 15, 2022

Hello @godambrosio,

thanks for the feedback. Please have a look to #2369, maybe that helps.
You have to provide the macros, e.g. __has_builtin()...

Regards,

@guwirth guwirth changed the title CXX sensor ignored due to Cannot parse error Cannot parse __has_builtin Jun 16, 2022
@guwirth
Copy link
Collaborator

guwirth commented Jun 17, 2022

Please read:
https://github.com/SonarOpenCommunity/sonar-cxx/wiki/Detect-and-fix-parsing-errors

Some more hints:
https://clang.llvm.org/docs/LanguageExtensions.html

Sample:
https://github.com/SonarOpenCommunity/sonar-cxx/wiki/sonar.cxx.defines

    __has_builtin(a) 0\n\
    __has_cpp_attribute(a) 0\n\
    __has_include(a) 0\n\
    __is_identifier 0\n\

@guwirth guwirth modified the milestone: 2.1.0 Jun 30, 2022
guwirth added a commit to guwirth/sonar-cxx that referenced this issue Jul 26, 2022
* https://clang.llvm.org/docs/LanguageExtensions.html

```
#define __has_builtin(x) 0
#define __has_feature(x) 0
#define __has_extension(x) 0
#define __has_cpp_attribute(x) 0
#define __has_c_attribute(x) 0
#define __has_attribute(x) 0
#define __has_declspec_attribute(x) 0
#define __is_identifier(x) 1
#define __has_warning(x) 0
```

* close SonarOpenCommunity#2395
* close SonarOpenCommunity#2376
* close SonarOpenCommunity#2369
guwirth added a commit to guwirth/sonar-cxx that referenced this issue Jul 26, 2022
* https://clang.llvm.org/docs/LanguageExtensions.html

```
#define __has_builtin(x) 0
#define __has_feature(x) 0
#define __has_extension(x) 0
#define __has_cpp_attribute(x) 0
#define __has_c_attribute(x) 0
#define __has_attribute(x) 0
#define __has_declspec_attribute(x) 0
#define __is_identifier(x) 1
#define __has_warning(x) 0
```

* close SonarOpenCommunity#2395
* close SonarOpenCommunity#2376
* close SonarOpenCommunity#2369
guwirth added a commit to guwirth/sonar-cxx that referenced this issue Jul 26, 2022
* https://clang.llvm.org/docs/LanguageExtensions.html

```
#define __has_builtin(x) 0
#define __has_feature(x) 0
#define __has_extension(x) 0
#define __has_cpp_attribute(x) 0
#define __has_c_attribute(x) 0
#define __has_attribute(x) 0
#define __has_declspec_attribute(x) 0
#define __is_identifier(x) 1
#define __has_warning(x) 0
```

* close SonarOpenCommunity#2395
* close SonarOpenCommunity#2376
* close SonarOpenCommunity#2369
guwirth added a commit to guwirth/sonar-cxx that referenced this issue Jul 26, 2022
* https://clang.llvm.org/docs/LanguageExtensions.html

```
#define __has_builtin(x) 0
#define __has_feature(x) 0
#define __has_extension(x) 0
#define __has_cpp_attribute(x) 0
#define __has_c_attribute(x) 0
#define __has_attribute(x) 0
#define __has_declspec_attribute(x) 0
#define __is_identifier(x) 1
#define __has_warning(x) 0
```

* close SonarOpenCommunity#2395
* close SonarOpenCommunity#2376
* close SonarOpenCommunity#2369
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
2 participants