summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2023-01-11 17:55:39 +0100
committerBent Bisballe Nyeng <deva@aasimon.org>2023-01-11 17:55:39 +0100
commit10dc0902c22ae931fe51c36ea8fc6d2453819477 (patch)
tree0b66071313e48e61ad02e58010e3f3dfda8e4b34 /src
parent75d1fa7244b9c5cddae056a281f457dd1e81cfb2 (diff)
Rename Language::Xyz to language::xyz
Diffstat (limited to 'src')
-rw-r--r--src/ctor.h20
-rw-r--r--src/task.cc6
-rw-r--r--src/task.h4
-rw-r--r--src/task_ar.cc4
-rw-r--r--src/task_cc.cc22
-rw-r--r--src/task_ld.cc4
-rw-r--r--src/task_so.cc4
-rw-r--r--src/util.cc8
-rw-r--r--src/util.h2
9 files changed, 37 insertions, 37 deletions
diff --git a/src/ctor.h b/src/ctor.h
index 2fefac3..dbcfa66 100644
--- a/src/ctor.h
+++ b/src/ctor.h
@@ -26,13 +26,13 @@ enum class target_type
function,
};
-enum class Language
+enum class language
{
- Auto, // Default - deduce language from source extensions
+ automatic, // Default - deduce language from source extensions
- C,
- Cpp,
- Asm,
+ c,
+ cpp,
+ assembler,
};
enum class OutputSystem
@@ -45,16 +45,16 @@ struct Source
{
Source(const char* file) : file(file) {}
Source(const std::string& file) : file(file) {}
- Source(const char* file, Language lang) : file(file), language(lang) {}
- Source(const std::string& file, Language lang) : file(file), language(lang) {}
+ Source(const char* file, ctor::language lang) : file(file), language(lang) {}
+ Source(const std::string& file, ctor::language lang) : file(file), language(lang) {}
Source(const char* file, const char* output) : file(file), output(output) {}
Source(const std::string& file, const std::string& output) : file(file), output(output) {}
- Source(const char* file, Language lang, const char* output) : file(file), language(lang), output(output) {}
- Source(const std::string& file, Language lang, const std::string& output) : file(file), language(lang), output(output) {}
+ Source(const char* file, ctor::language lang, const char* output) : file(file), language(lang), output(output) {}
+ Source(const std::string& file, ctor::language lang, const std::string& output) : file(file), language(lang), output(output) {}
std::string file;
- Language language{Language::Auto};
+ ctor::language language{ctor::language::automatic};
std::string output{};
};
diff --git a/src/task.cc b/src/task.cc
index fa843c7..eba365f 100644
--- a/src/task.cc
+++ b/src/task.cc
@@ -119,7 +119,7 @@ ctor::target_type Task::targetType() const
return target_type;
}
-Language Task::sourceLanguage() const
+ctor::language Task::sourceLanguage() const
{
return source_language;
}
@@ -133,7 +133,7 @@ std::string Task::compiler() const
{
switch(sourceLanguage())
{
- case Language::C:
+ case ctor::language::c:
switch(outputSystem())
{
case OutputSystem::Host:
@@ -141,7 +141,7 @@ std::string Task::compiler() const
case OutputSystem::Build:
return getConfiguration(cfg::build_cc, "/usr/bin/gcc");
}
- case Language::Cpp:
+ case ctor::language::cpp:
switch(outputSystem())
{
case OutputSystem::Host:
diff --git a/src/task.h b/src/task.h
index 1d61665..673df67 100644
--- a/src/task.h
+++ b/src/task.h
@@ -60,7 +60,7 @@ public:
const ctor::BuildConfiguration& buildConfig() const;
ctor::target_type targetType() const;
- ctor::Language sourceLanguage() const;
+ ctor::language sourceLanguage() const;
ctor::OutputSystem outputSystem() const;
std::string compiler() const;
@@ -77,7 +77,7 @@ protected:
std::set<std::shared_ptr<Task>> dependsTasks;
const ctor::BuildConfiguration& config;
ctor::target_type target_type{ctor::target_type::automatic};
- ctor::Language source_language{ctor::Language::Auto};
+ ctor::language source_language{ctor::language::automatic};
ctor::OutputSystem output_system{ctor::OutputSystem::Host};
const ctor::Settings& settings;
std::string sourceDir;
diff --git a/src/task_ar.cc b/src/task_ar.cc
index eaf23e6..528e71a 100644
--- a/src/task_ar.cc
+++ b/src/task_ar.cc
@@ -41,14 +41,14 @@ TaskAR::TaskAR(const BuildConfiguration& config,
flagsFile += ".flags";
target_type = ctor::target_type::static_library;
- source_language = Language::C;
+ source_language = ctor::language::c;
for(const auto& source : config.sources)
{
std::filesystem::path sourceFile(source.file);
// TODO: Use task languages instead
if(sourceFile.extension().string() != ".c")
{
- source_language = Language::Cpp;
+ source_language = ctor::language::cpp;
}
}
}
diff --git a/src/task_cc.cc b/src/task_cc.cc
index 2b1e648..581ca12 100644
--- a/src/task_cc.cc
+++ b/src/task_cc.cc
@@ -34,23 +34,23 @@ TaskCC::TaskCC(const BuildConfiguration& config, const Settings& settings,
target_type = ctor::target_type::object;
source_language = source.language;
- if(source_language == Language::Auto)
+ if(source_language == ctor::language::automatic)
{
source_language = languageFromExtension(sourceFile);
}
switch(source_language)
{
- case Language::C:
+ case ctor::language::c:
base += "_c";
break;
- case Language::Cpp:
+ case ctor::language::cpp:
base += "_cc";
break;
- case Language::Asm:
+ case ctor::language::assembler:
base += "_asm";
break;
- case Language::Auto:
+ case ctor::language::automatic:
assert(0 && "This should never happen");
break;
}
@@ -171,14 +171,14 @@ int TaskCC::runInner()
{
switch(sourceLanguage())
{
- case Language::C:
+ case ctor::language::c:
std::cout << "CC ";
break;
- case Language::Cpp:
+ case ctor::language::cpp:
std::cout << "CXX ";
break;
- case Language::Auto:
- case Language::Asm:
+ case ctor::language::automatic:
+ case ctor::language::assembler:
// Only c/c++ handled by this task type.
break;
}
@@ -260,9 +260,9 @@ std::vector<std::string> TaskCC::flags() const
{
switch(sourceLanguage())
{
- case Language::C:
+ case ctor::language::c:
return config.flags.cflags;
- case Language::Cpp:
+ case ctor::language::cpp:
return config.flags.cxxflags;
default:
std::cerr << "Unknown CC target type\n";
diff --git a/src/task_ld.cc b/src/task_ld.cc
index 9a36bd9..20a4f37 100644
--- a/src/task_ld.cc
+++ b/src/task_ld.cc
@@ -47,13 +47,13 @@ TaskLD::TaskLD(const BuildConfiguration& config,
flagsFile = std::filesystem::path(settings.builddir) / cleanUp(sourceDir) / targetFile().stem();
flagsFile += ".flags";
- source_language = Language::C;
+ source_language = ctor::language::c;
for(const auto& source : config.sources)
{
std::filesystem::path sourceFile(source.file);
if(sourceFile.extension().string() != ".c")
{
- source_language = Language::Cpp;
+ source_language = ctor::language::cpp;
}
}
}
diff --git a/src/task_so.cc b/src/task_so.cc
index 4d154d7..d7c0820 100644
--- a/src/task_so.cc
+++ b/src/task_so.cc
@@ -43,14 +43,14 @@ TaskSO::TaskSO(const BuildConfiguration& config,
flagsFile += ".flags";
target_type = ctor::target_type::dynamic_library;
- source_language = Language::C;
+ source_language = ctor::language::c;
for(const auto& source : config.sources)
{
std::filesystem::path sourceFile(source.file);
// TODO: Use task languages instead
if(sourceFile.extension().string() != ".c")
{
- source_language = Language::Cpp;
+ source_language = ctor::language::cpp;
}
}
}
diff --git a/src/util.cc b/src/util.cc
index 47cb5c4..f25b7eb 100644
--- a/src/util.cc
+++ b/src/util.cc
@@ -82,12 +82,12 @@ std::vector<std::string> readDeps(const std::string& depFile)
return output;
}
-Language languageFromExtension(const std::filesystem::path& file)
+ctor::language languageFromExtension(const std::filesystem::path& file)
{
auto ext = file.extension().string();
if(ext == ".c")
{
- return Language::C;
+ return ctor::language::c;
}
if(ext == ".C" ||
@@ -98,14 +98,14 @@ Language languageFromExtension(const std::filesystem::path& file)
ext == ".cp" ||
ext == ".cxx")
{
- return Language::Cpp;
+ return ctor::language::cpp;
}
if(ext == ".s" ||
ext == ".S" ||
ext == ".asm")
{
- return Language::Asm;
+ return ctor::language::assembler;
}
std::cerr << "Could not deduce language from " << file.string() << "\n";
diff --git a/src/util.h b/src/util.h
index 1b41823..d5fccc8 100644
--- a/src/util.h
+++ b/src/util.h
@@ -10,7 +10,7 @@
std::string readFile(const std::string& fileName);
std::vector<std::string> readDeps(const std::string& depFile);
-ctor::Language languageFromExtension(const std::filesystem::path& file);
+ctor::language languageFromExtension(const std::filesystem::path& file);
std::string cleanUp(const std::string& path);
template<typename T>