forked from SonarOpenCommunity/sonar-cxx
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add test for SonarOpenCommunity#2094
- Loading branch information
Showing
5 changed files
with
67 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
integration-tests/testdata/macro_propagation_project/sonar-project.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# metadata | ||
sonar.projectKey=macro_propagation_project | ||
|
||
# disable SCM support | ||
sonar.scm.disabled=true | ||
|
||
# disable XML sensor | ||
sonar.xml.file.suffixes=.disable-xml | ||
|
||
# file extensions assigned to the cxx programming language | ||
sonar.cxx.file.suffixes=.cxx,.cpp,.cc,.c,.hxx,.hpp,.hh,.h | ||
|
||
# comma-separated paths to directories containing source files | ||
sonar.sources=src |
13 changes: 13 additions & 0 deletions
13
integration-tests/testdata/macro_propagation_project/src/header.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// header.h | ||
|
||
#ifndef HEADER | ||
#define HEADER | ||
|
||
template<typename T> | ||
void f(); | ||
|
||
#define HEADER_IMPL // The macro is set before including header.hpp | ||
#include "header.hpp" | ||
#undef HEADER_IMPL | ||
|
||
#endif |
10 changes: 10 additions & 0 deletions
10
integration-tests/testdata/macro_propagation_project/src/header.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// header.hpp | ||
|
||
#ifdef HEADER_IMPL // This is an ifdef, not an ifndef! | ||
|
||
template<typename T> | ||
void f() { | ||
// do something... | ||
} | ||
|
||
#endif |
8 changes: 8 additions & 0 deletions
8
integration-tests/testdata/macro_propagation_project/src/main.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// main.cpp | ||
|
||
#include "header.h" | ||
|
||
int main(int argc, char *argv[]) { | ||
f<int>(); | ||
return 0; | ||
} |