Skip to content
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

Independent compiler versions for different back-ends #350

Merged
merged 3 commits into from
Mar 9, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions backends/bmv2/bmv2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ int main(int argc, char *const argv[]) {

CompilerOptions options;
options.langVersion = CompilerOptions::FrontendVersion::P4_16;
options.compilerVersion = "0.0.5";

if (options.process(argc, argv) != nullptr)
options.setInputFile();
Expand Down
2 changes: 2 additions & 0 deletions backends/ebpf/p4c-ebpf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ int main(int argc, char *const argv[]) {
setup_signals();

EbpfOptions options;
options.compilerVersion = "0.0.1";

if (options.process(argc, argv) != nullptr)
options.setInputFile();
if (::errorCount() > 0)
Expand Down
1 change: 1 addition & 0 deletions backends/p4test/p4test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ int main(int argc, char *const argv[]) {

CompilerOptions options;
options.langVersion = CompilerOptions::FrontendVersion::P4_16;
options.compilerVersion = "0.0.5";

if (options.process(argc, argv) != nullptr)
options.setInputFile();
Expand Down
3 changes: 1 addition & 2 deletions frontends/common/options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ limitations under the License.
#include "frontends/p4/toP4/toP4.h"
#include "ir/json_generator.h"

static cstring version = "0.0.5";
const char* CompilerOptions::defaultMessage = "Compile a P4 program";

CompilerOptions::CompilerOptions() : Util::Options(defaultMessage) {
Expand All @@ -38,7 +37,7 @@ CompilerOptions::CompilerOptions() : Util::Options(defaultMessage) {
registerOption("--version", nullptr,
[this](const char*) {
std::cerr << binaryName << std::endl;
std::cerr << "Version " << version << std::endl;
std::cerr << "Version " << compilerVersion << std::endl;
exit(0); return false; }, "Print compiler version");
registerOption("-I", "path",
[this](const char* arg) {
Expand Down
2 changes: 2 additions & 0 deletions frontends/common/options.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ class CompilerOptions : public Util::Options {
cstring prettyPrintFile = nullptr;
// file to output to
cstring outputFile = nullptr;
// Compiler version.
cstring compilerVersion;

// Dump a JSON representation of the IR in the file
cstring dumpJsonFile = nullptr;
Expand Down