浏览代码

support all other gnu variants for completeness

gnu_extensions
John Robinson 3 年前
父节点
当前提交
3553bf9341
找不到此签名对应的密钥
共有 3 个文件被更改,包括 49 次插入2 次删除
  1. +8
    -1
      res/toolchain-schema.json
  2. +36
    -1
      src/dds/toolchain/from_json.cpp
  3. +5
    -0
      src/dds/toolchain/toolchain.cpp

+ 8
- 1
res/toolchain-schema.json 查看文件

@@ -72,7 +72,9 @@
"c99",
"c11",
"c18",
"gnu89",
"gnu99",
"gnu11",
"gnu18"
]
},
@@ -86,6 +88,11 @@
"c++14",
"c++17",
"c++20",
"gnu++98",
"gnu++03",
"gnu++11",
"gnu++14",
"gnu++17",
"gnu++20"
]
},
@@ -214,4 +221,4 @@
}
}
}
}
}

+ 36
- 1
src/dds/toolchain/from_json.cpp 查看文件

@@ -320,7 +320,9 @@ toolchain dds::parse_toolchain_json_data(const json5::data& dat, std::string_vie
c99,
c11,
c18,
gnu89,
gnu99,
gnu11,
gnu18,
} c_version_e
= [&] {
@@ -334,8 +336,12 @@ toolchain dds::parse_toolchain_json_data(const json5::data& dat, std::string_vie
return c11;
} else if (c_version == "c18") {
return c18;
} else if (c_version == "gnu89") {
return gnu89;
} else if (c_version == "gnu99") {
return gnu99;
} else if (c_version == "gnu11") {
return gnu11;
} else if (c_version == "gnu18") {
return gnu18;
} else {
@@ -351,6 +357,11 @@ toolchain dds::parse_toolchain_json_data(const json5::data& dat, std::string_vie
cxx14,
cxx17,
cxx20,
gnuxx98,
gnuxx03,
gnuxx11,
gnuxx14,
gnuxx17,
gnuxx20,
} cxx_version_e
= [&] {
@@ -368,6 +379,16 @@ toolchain dds::parse_toolchain_json_data(const json5::data& dat, std::string_vie
return cxx17;
} else if (cxx_version == "c++20") {
return cxx20;
} else if (cxx_version == "gnu++98") {
return gnuxx98;
} else if (cxx_version == "gnu++03") {
return gnuxx03;
} else if (cxx_version == "gnu++11") {
return gnuxx11;
} else if (cxx_version == "gnu++14") {
return gnuxx14;
} else if (cxx_version == "gnu++17") {
return gnuxx17;
} else if (cxx_version == "gnu++20") {
return gnuxx20;
} else {
@@ -386,14 +407,18 @@ toolchain dds::parse_toolchain_json_data(const json5::data& dat, std::string_vie
{{gnu, c99}, {"-std=c99"}},
{{gnu, c11}, {"-std=c11"}},
{{gnu, c18}, {"-std=c18"}},
{{gnu, gnu89}, {"-std=gnu89"}},
{{gnu, gnu99}, {"-std=gnu99"}},
{{gnu, gnu11}, {"-std=gnu11"}},
{{gnu, gnu18}, {"-std=gnu18"}},
{{clang, c_none}, {}},
{{clang, c89}, {"-std=c89"}},
{{clang, c99}, {"-std=c99"}},
{{clang, c11}, {"-std=c11"}},
{{clang, c18}, {"-std=c18"}},
{{clang, gnu89}, {"-std=gnu89"}},
{{clang, gnu99}, {"-std=gnu99"}},
{{clang, gnu11}, {"-std=gnu11"}},
{{clang, gnu18}, {"-std=gnu18"}},
};

@@ -421,6 +446,11 @@ toolchain dds::parse_toolchain_json_data(const json5::data& dat, std::string_vie
{{gnu, cxx14}, {"-std=c++14"}},
{{gnu, cxx17}, {"-std=c++17"}},
{{gnu, cxx20}, {"-std=c++20"}},
{{gnu, gnuxx98}, {"-std=gnu++98"}},
{{gnu, gnuxx03}, {"-std=gnu++03"}},
{{gnu, gnuxx11}, {"-std=gnu++11"}},
{{gnu, gnuxx14}, {"-std=gnu++14"}},
{{gnu, gnuxx17}, {"-std=gnu++17"}},
{{gnu, gnuxx20}, {"-std=gnu++20"}},
{{clang, cxx_none}, {}},
{{clang, cxx98}, {"-std=c++98"}},
@@ -429,6 +459,11 @@ toolchain dds::parse_toolchain_json_data(const json5::data& dat, std::string_vie
{{clang, cxx14}, {"-std=c++14"}},
{{clang, cxx17}, {"-std=c++17"}},
{{clang, cxx20}, {"-std=c++20"}},
{{clang, gnuxx98}, {"-std=gnu++98"}},
{{clang, gnuxx03}, {"-std=gnu++03"}},
{{clang, gnuxx11}, {"-std=gnu++11"}},
{{clang, gnuxx14}, {"-std=gnu++14"}},
{{clang, gnuxx17}, {"-std=gnu++17"}},
{{clang, gnuxx20}, {"-std=gnu++20"}},
};

@@ -727,4 +762,4 @@ toolchain dds::parse_toolchain_json_data(const json5::data& dat, std::string_vie
});

return tc.realize();
}
}

+ 5
- 0
src/dds/toolchain/toolchain.cpp 查看文件

@@ -231,6 +231,11 @@ std::optional<toolchain> toolchain::get_builtin(std::string_view tc_id) noexcept
CXX_VER_TAG("c++14:", "c++14");
CXX_VER_TAG("c++17:", "c++17");
CXX_VER_TAG("c++20:", "c++20");
CXX_VER_TAG("gnu++98:", "gnu++98");
CXX_VER_TAG("gnu++03:", "gnu++03");
CXX_VER_TAG("gnu++11:", "gnu++11");
CXX_VER_TAG("gnu++14:", "gnu++14");
CXX_VER_TAG("gnu++17:", "gnu++17");
CXX_VER_TAG("gnu++20:", "gnu++20");

struct compiler_info {

正在加载...
取消
保存