Skip to content

Commit ec06a73

Browse files
iprtelIngo PrötelhsutterIngo Prötel
authored
Add version and build of cppfront to generated files. (#791)
* Add version and build of cppfront to generated files. * Add a flag to control the information * Add version and build of cppfront to generated files. * Cherry-Picked: Add a flag to control the information by Herb Sutter * Added missed file. --------- Signed-off-by: Herb Sutter <[email protected]> Co-authored-by: Ingo Prötel <[email protected]> Co-authored-by: Herb Sutter <[email protected]> Co-authored-by: Ingo Prötel <[email protected]>
1 parent 210b2a0 commit ec06a73

File tree

3 files changed

+20
-1
lines changed

3 files changed

+20
-1
lines changed

source/common.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -821,7 +821,9 @@ class cmdline_processor
821821
-> void
822822
{
823823
help_requested = true;
824-
print("\ncppfront compiler v0.3.0 Build "
824+
print("\ncppfront compiler "
825+
#include "version.info"
826+
" Build "
825827
#include "build.info"
826828
);
827829
print("\nCopyright(c) Herb Sutter All rights reserved\n");

source/to_cpp1.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,14 @@ auto pad(int padding)
6363
//
6464
//-----------------------------------------------------------------------
6565
//
66+
static auto flag_emit_cppfront_info = false;
67+
static cmdline_processor::register_flag cmd_emit_cppfront_info(
68+
9,
69+
"emit-cppfront-info",
70+
"Emit cppfront version/build in output file",
71+
[]{ flag_emit_cppfront_info = true; }
72+
);
73+
6674
static auto flag_clean_cpp1 = false;
6775
static cmdline_processor::register_flag cmd_clean_cpp1(
6876
9,
@@ -1289,6 +1297,14 @@ class cppfront
12891297
|| flag_include_std
12901298
)
12911299
{
1300+
if (flag_emit_cppfront_info) {
1301+
printer.print_extra(
1302+
"\n// Generated by cppfront "
1303+
#include "version.info"
1304+
" build "
1305+
#include "build.info"
1306+
);
1307+
}
12921308
printer.print_extra( "\n" );
12931309
if (cpp1_filename.back() == 'h') {
12941310
printer.print_extra( "#ifndef " + cpp1_FILENAME+"_CPP2\n");

source/version.info

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"v0.3.0"

0 commit comments

Comments
 (0)