-
Notifications
You must be signed in to change notification settings - Fork 273
CBMC_VERSION: Use generated include files instead of command-line defines #2393
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -56,6 +56,8 @@ Author: Daniel Kroening, [email protected] | |
#include <goto-analyzer/taint_analysis.h> | ||
#include <goto-analyzer/unreachable_instructions.h> | ||
|
||
#include "version.h" | ||
|
||
janalyzer_parse_optionst::janalyzer_parse_optionst(int argc, const char **argv) | ||
: parse_options_baset(JANALYZER_OPTIONS, argc, argv), | ||
messaget(ui_message_handler), | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -60,6 +60,8 @@ Author: Daniel Kroening, [email protected] | |
#include <java_bytecode/replace_java_nondet.h> | ||
#include <java_bytecode/simple_method_stubbing.h> | ||
|
||
#include "version.h" | ||
|
||
jbmc_parse_optionst::jbmc_parse_optionst(int argc, const char **argv): | ||
parse_options_baset(JBMC_OPTIONS, argc, argv), | ||
messaget(ui_message_handler), | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -64,6 +64,8 @@ Author: Daniel Kroening, [email protected] | |
|
||
#include "xml_interface.h" | ||
|
||
#include "version.h" | ||
|
||
cbmc_parse_optionst::cbmc_parse_optionst(int argc, const char **argv): | ||
parse_options_baset(CBMC_OPTIONS, argc, argv), | ||
xml_interfacet(cmdline), | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,6 +28,7 @@ Author: Daniel Kroening, [email protected] | |
#include "bv_cbmc.h" | ||
#include "cbmc_dimacs.h" | ||
#include "counterexample_beautification.h" | ||
#include "version.h" | ||
|
||
/// Uses the options to pick an SMT 2.0 solver | ||
/// \return An smt2_dect::solvert giving the solver to use. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,6 +34,7 @@ Author: Daniel Kroening, [email protected] | |
|
||
#include <langapi/mode.h> | ||
|
||
#include "version.h" | ||
|
||
clobber_parse_optionst::clobber_parse_optionst(int argc, const char **argv): | ||
parse_options_baset(CLOBBER_OPTIONS, argc, argv), | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -229,23 +229,18 @@ OBJ += $(patsubst %.cc, %$(OBJEXT), $(filter %.cc, $(SRC))) | |
|
||
# get version from git | ||
GIT_INFO = $(shell git describe --tags --always --dirty || echo "n/a") | ||
GIT_INFO_FILE = .release_info | ||
RELEASE_INFO = \#define CBMC_VERSION "$(CBMC_VERSION) ($(GIT_INFO))" | ||
GIT_INFO_FILE = version.h | ||
|
||
CBMC_VERSION_FILES += $(filter %_parse_options$(OBJEXT), $(OBJ)) | ||
$(GIT_INFO_FILE): | ||
echo '$(RELEASE_INFO)' > $@ | ||
|
||
ifeq ($(BUILD_ENV_),MSVC) | ||
$(CBMC_VERSION_FILES): CP_CXXFLAGS += /DCBMC_VERSION='"""$(CBMC_VERSION) ($(GIT_INFO))"""' | ||
else | ||
$(CBMC_VERSION_FILES): CP_CXXFLAGS += -DCBMC_VERSION="\"$(CBMC_VERSION) ($(GIT_INFO))\"" | ||
endif | ||
$(filter %_parse_options$(OBJEXT), $(OBJ)): $(GIT_INFO_FILE) | ||
|
||
# mark the actually generated file as a phony target to enforce a rebuild - but | ||
# only of the version information has changed! | ||
KNOWN_RELEASE_INFO = $(shell cat $(GIT_INFO_FILE) 2>/dev/null) | ||
ifneq ($(GIT_INFO), $(KNOWN_RELEASE_INFO)) | ||
$(CBMC_VERSION_FILES): $(GIT_INFO_FILE) | ||
|
||
$(GIT_INFO_FILE): | ||
echo $(GIT_INFO) > $@ | ||
|
||
ifneq ($(RELEASE_INFO), $(KNOWN_RELEASE_INFO)) | ||
.PHONY: $(GIT_INFO_FILE) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh, I see - this is some sneaky logic to avoid updating the timestamp on the GIT_INFO_FILE if the version info hasn't changed - nice, but could you add a comment to explain that ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll add that comment, but the build failures on Travis and AppVeyor make me wonder whether this actually works as it should (it definitively does so locally). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I had messed up quoting. Thus it did not actually work as supposed... I'll push an update addressing this once #2415 is merged. |
||
endif | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -61,6 +61,7 @@ Author: Daniel Kroening, [email protected] | |
#include "static_show_domain.h" | ||
#include "static_simplifier.h" | ||
#include "static_verifier.h" | ||
#include "version.h" | ||
|
||
goto_analyzer_parse_optionst::goto_analyzer_parse_optionst( | ||
int argc, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,11 +38,6 @@ LIBS = | |
|
||
CLEANFILES = goto-cc$(EXEEXT) goto-cl$(EXEEXT) | ||
|
||
CBMC_VERSION_FILES = as_mode$(OBJEXT) \ | ||
compile$(OBJEXT) \ | ||
gcc_mode$(OBJEXT) \ | ||
goto_cc_mode$(OBJEXT) | ||
|
||
include ../config.inc | ||
include ../common | ||
|
||
|
@@ -51,6 +46,8 @@ all: goto-cl$(EXEEXT) | |
endif | ||
all: goto-cc$(EXEEXT) | ||
|
||
as_mode$(OBJEXT) compile$(OBJEXT) gcc_mode$(OBJEXT) goto_cc_mode$(OBJEXT): $(GIT_INFO_FILE) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ditto my comment about whether the dependency would now be auto-generated from the |
||
|
||
ifneq ($(wildcard ../jsil/Makefile),) | ||
OBJ += ../jsil/jsil$(LIBEXT) | ||
CP_CXXFLAGS += -DHAVE_JSIL | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -98,6 +98,7 @@ Author: Daniel Kroening, [email protected] | |
#include "undefined_functions.h" | ||
#include "remove_function.h" | ||
#include "splice_call.h" | ||
#include "version.h" | ||
|
||
/// invoke main modules | ||
int goto_instrument_parse_optionst::doit() | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,6 +18,7 @@ Author: Daniel Kroening, [email protected] | |
|
||
#include "mm_parser.h" | ||
#include "mm2cpp.h" | ||
#include "version.h" | ||
|
||
mmcc_parse_optionst::mmcc_parse_optionst(int argc, const char **argv): | ||
parse_options_baset(MMCC_OPTIONS, argc, argv) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given that the version info is now pulled in by a standard
#include
- do you actually need to add explicit rules for the dependency any more? Wouldn't that be picked up by.d
files just like any other include ?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had thought the same, but actually this isn't true: the
.d
file will only be built as a side-effect of compilation, and thus only helps for re-builds - it won't do the trick in a clean build tree!There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh right, I see. I wonder if we can arrange for the generation target to be run in the first build without having to add these dependencies explicitly like this...