From: Andres Noetzli Date: Wed, 22 Jun 2022 01:36:22 +0000 (-0700) Subject: [Parser] Rename generated `.c` to `.cpp` files (#8894) X-Git-Tag: cvc5-1.0.1~46 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=bb1c914e2d4c556bbfe29140715d52867d613c25;p=cvc5.git [Parser] Rename generated `.c` to `.cpp` files (#8894) Using Clang on my machine, I am seeing the following warning: ``` clang-13: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated [-Wdeprecated] ``` This is because we are treating the generated `.c` files as C++ files. To make our build system more robust, this commit changes our command for generating files to rename the generated files to use the `.cpp` extension. --- diff --git a/src/parser/CMakeLists.txt b/src/parser/CMakeLists.txt index 4a672b1c1..74fd7c4e5 100644 --- a/src/parser/CMakeLists.txt +++ b/src/parser/CMakeLists.txt @@ -48,8 +48,6 @@ set(libcvc5parser_src_files smt2/smt2_input.h smt2/sygus_input.cpp smt2/sygus_input.h - tptp/TptpLexer.c - tptp/TptpParser.c tptp/tptp.cpp tptp/tptp.h tptp/tptp_input.cpp @@ -62,26 +60,33 @@ set(libcvc5parser_src_files foreach(lang Smt2 Tptp) string(TOLOWER ${lang} lang_dir) file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${lang_dir}) + + set(gen_src_files + ${CMAKE_CURRENT_BINARY_DIR}/${lang_dir}/${lang}Lexer.cpp + ${CMAKE_CURRENT_BINARY_DIR}/${lang_dir}/${lang}Parser.cpp) add_custom_command( OUTPUT - ${CMAKE_CURRENT_BINARY_DIR}/${lang_dir}/${lang}Lexer.c + ${gen_src_files} ${CMAKE_CURRENT_BINARY_DIR}/${lang_dir}/${lang}Lexer.h - ${CMAKE_CURRENT_BINARY_DIR}/${lang_dir}/${lang}Parser.c ${CMAKE_CURRENT_BINARY_DIR}/${lang_dir}/${lang}Parser.h ${CMAKE_CURRENT_BINARY_DIR}/${lang_dir}/${lang}.tokens COMMAND ${ANTLR3_COMMAND} ${CMAKE_CURRENT_SOURCE_DIR}/${lang_dir}/${lang}.g -fo ${CMAKE_CURRENT_BINARY_DIR}/${lang_dir} + COMMAND + # We actually generate C++ files with ANTLR + ${CMAKE_COMMAND} -E rename + ${CMAKE_CURRENT_BINARY_DIR}/${lang_dir}/${lang}Lexer.c + ${CMAKE_CURRENT_BINARY_DIR}/${lang_dir}/${lang}Lexer.cpp + COMMAND + # We actually generate C++ files with ANTLR + ${CMAKE_COMMAND} -E rename + ${CMAKE_CURRENT_BINARY_DIR}/${lang_dir}/${lang}Parser.c + ${CMAKE_CURRENT_BINARY_DIR}/${lang_dir}/${lang}Parser.cpp DEPENDS ${lang_dir}/${lang}.g ) - set(gen_src_files - ${CMAKE_CURRENT_BINARY_DIR}/${lang_dir}/${lang}Lexer.c - ${CMAKE_CURRENT_BINARY_DIR}/${lang_dir}/${lang}Parser.c) - - # Tell cmake that generated source files are actually c++ files - set_source_files_properties(${gen_src_files} PROPERTIES LANGUAGE CXX) set_source_files_properties(${gen_src_files} PROPERTIES GENERATED TRUE) # We don't want to enable -Wall for code generated by ANTLR.