diff --git a/source/common.h b/source/common.h index 660e72be1..fe0301c14 100644 --- a/source/common.h +++ b/source/common.h @@ -821,7 +821,9 @@ class cmdline_processor -> void { help_requested = true; - print("\ncppfront compiler v0.3.0 Build " + print("\ncppfront compiler " + #include "version.info" + " Build " #include "build.info" ); print("\nCopyright(c) Herb Sutter All rights reserved\n"); diff --git a/source/to_cpp1.h b/source/to_cpp1.h index d4cfd47c1..a7b6782b6 100644 --- a/source/to_cpp1.h +++ b/source/to_cpp1.h @@ -63,6 +63,14 @@ auto pad(int padding) // //----------------------------------------------------------------------- // +static auto flag_emit_cppfront_info = false; +static cmdline_processor::register_flag cmd_emit_cppfront_info( + 9, + "emit-cppfront-info", + "Emit cppfront version/build in output file", + []{ flag_emit_cppfront_info = true; } +); + static auto flag_clean_cpp1 = false; static cmdline_processor::register_flag cmd_clean_cpp1( 9, @@ -1289,6 +1297,14 @@ class cppfront || flag_include_std ) { + if (flag_emit_cppfront_info) { + printer.print_extra( + "\n// Generated by cppfront " + #include "version.info" + " build " + #include "build.info" + ); + } printer.print_extra( "\n" ); if (cpp1_filename.back() == 'h') { printer.print_extra( "#ifndef " + cpp1_FILENAME+"_CPP2\n"); diff --git a/source/version.info b/source/version.info new file mode 100644 index 000000000..87fe59a1f --- /dev/null +++ b/source/version.info @@ -0,0 +1 @@ +"v0.3.0" \ No newline at end of file