Skip to content
Snippets Groups Projects
Commit 32318c99 authored by Andre Sailer's avatar Andre Sailer
Browse files

DDTest: add test to ensure GrammarParsed/Unparsed are not includable, fix pragma for error

Unknown pragma error
parent 18b60440
No related branches found
No related tags found
No related merge requests found
......@@ -22,7 +22,7 @@
#define DD4HEP_GRAMMARPARSED_H
#if defined(DD4HEP_GRAMMARUNPARSED_H)
#pragma error "The header files GrammarParsed.h and GrammarUnparsed.h may not be included in the same compilation unit!"
#error "The header files GrammarParsed.h and GrammarUnparsed.h may not be included in the same compilation unit!"
#endif
/// Framework include files
......
......@@ -22,7 +22,7 @@
#define DD4HEP_GRAMMARUNPARSED_H
#if defined(DD4HEP_GRAMMARPARSED_H)
#pragma error "The header files GrammarParsed.h and GrammarUnparsed.h may not be included in the same compilation unit!"
#error "The header files GrammarParsed.h and GrammarUnparsed.h may not be included in the same compilation unit!"
#endif
// Framework include files
......
......@@ -96,3 +96,19 @@ if (DD4HEP_USE_GEANT4)
endif()
install(DIRECTORY include/DD4hep DESTINATION include)
# Test that GrammarUnparsed and GrammarParsed fail to be compiled
add_executable(test_failToCompile src/test_failToCompileGrammar.cc)
target_link_libraries(test_failToCompile DD4hep::DDCore)
# Avoid building these targets normally
set_target_properties(test_failToCompile PROPERTIES
EXCLUDE_FROM_ALL TRUE
EXCLUDE_FROM_DEFAULT_BUILD TRUE)
add_test(NAME TestFailToCompile
COMMAND ${CMAKE_COMMAND} --build . --target test_failToCompile --config $<CONFIGURATION>
WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
set_tests_properties(TestFailToCompile
PROPERTIES
PASS_REGULAR_EXPRESSION "The header files GrammarParsed.h and GrammarUnparsed.h may not be included in the same compilation unit")
#include <DD4hep/GrammarParsed.h>
#include <DD4hep/GrammarUnparsed.h>
int main ()
{
return 0;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment