diff --git a/Libraries/CMakeLists.txt b/Libraries/CMakeLists.txt index 3e86b5f27..ab42b9666 100644 --- a/Libraries/CMakeLists.txt +++ b/Libraries/CMakeLists.txt @@ -7,6 +7,10 @@ # of patent rights can be found in the PATENTS file in the same directory. # +if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") + add_compile_options(-Wmissing-prototypes) +endif () + set(OLD_DEFAULT_COMPONENT ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME}) set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME libraries) diff --git a/Libraries/libbom/Sources/bom.c b/Libraries/libbom/Sources/bom.c index 4c1a1d825..7055381ea 100755 --- a/Libraries/libbom/Sources/bom.c +++ b/Libraries/libbom/Sources/bom.c @@ -28,7 +28,7 @@ struct bom_context { unsigned int iteration_count; }; -struct bom_context * +static struct bom_context * _bom_alloc(struct bom_context_memory memory) { struct bom_context *context = malloc(sizeof(*context)); diff --git a/Libraries/pbxproj/Tools/dump_xcodeproj.cpp b/Libraries/pbxproj/Tools/dump_xcodeproj.cpp index 3e64ef123..3c20ed05e 100644 --- a/Libraries/pbxproj/Tools/dump_xcodeproj.cpp +++ b/Libraries/pbxproj/Tools/dump_xcodeproj.cpp @@ -28,164 +28,7 @@ using namespace pbxproj; using namespace libutil; -void -DumpGroup(PBX::BaseGroup const *group, size_t indent = 0) -{ - bool IsVariant = group->type() == PBX::GroupItem::Type::VariantGroup; - printf("%*s%c%s%c\n", (int)(indent * 2), "", - IsVariant ? '{' : '[', - group->name().c_str(), - IsVariant ? '}' : ']'); - indent++; - for (auto child : group->children()) { - if (child->type() == PBX::GroupItem::Type::FileReference) { - printf("%*s%s [%s]\n", (int)(indent * 2), "", - child->name().c_str(), - child->path().c_str()); - } else if (child->type() == PBX::GroupItem::Type::ReferenceProxy) { - printf("%*s%s [proxy]\n", (int)(indent * 2), "", - child->name().c_str()); - } else { - DumpGroup(static_cast (child.get()), indent); - } - } - indent--; -} - -std::unique_ptr -GenerateConfigurationSettings(Filesystem const *filesystem, - PBX::Project::shared_ptr const &project, - XC::BuildConfiguration const &BC, - bool isProjectBC = false) -{ - std::unique_ptr settings = nullptr; - - if (!isProjectBC) { - for (auto const &PBC : project->buildConfigurationList()->buildConfigurations()) { - if (BC.name() == PBC->name()) { - settings = GenerateConfigurationSettings(filesystem, project, *PBC, true); - break; - } - } - } - - if (settings == nullptr) { - settings = plist::Dictionary::New(); - } - - for (pbxsetting::Setting const &setting : BC.buildSettings().settings()) { - std::string key = setting.name().c_str(); - std::string value = setting.value().raw().c_str(); - settings->set(key, plist::String::New(value)); - } - - if (auto baseConfigurationReference = BC.baseConfigurationReference()) { - auto environment = pbxsetting::Environment(); - auto config = pbxsetting::XC::Config::Load(filesystem, environment, environment.expand(baseConfigurationReference->resolve())); - if (config) { - pbxsetting::Level level = config->level(); - for (pbxsetting::Setting const &setting : level.settings()) { - std::string key = setting.name().c_str(); - std::string value = setting.value().raw().c_str(); - settings->set(key, plist::String::New(value)); - } - } - } - - if (settings->empty()) { - settings = nullptr; - } - - return settings; -} - -void -GetSourceFileReferences(PBX::Project::shared_ptr const &project, - std::string const &target, PBX::FileReference::vector &refs) -{ - for (auto const &I : project->targets()) { - if (I->name() != target) - continue; - - for (auto const &J : I->buildPhases()) { - switch (J->type()) { - case PBX::BuildPhase::Type::Sources: - { - auto BP = static_cast (J.get()); - if (BP) { - for (auto const &K : BP->files()) { - if (auto const &FR = K->fileRef()) { - if (FR->type() == PBX::GroupItem::Type::FileReference) { - refs.push_back(std::static_pointer_cast (FR)); - } - } - } - } - } - break; - default: - break; - } - } - break; - } -} - -void -GetSourceFilePaths(PBX::Project::shared_ptr const &project, - std::string const &target, std::set &paths) -{ - PBX::FileReference::vector refs; - GetSourceFileReferences(project, target, refs); - - for (auto const &ref : refs) { - paths.insert(project->basePath() + "/" + ref->path()); - } -} - -void -GetHeaderFileReferences(PBX::Project::shared_ptr const &project, - std::string const &target, PBX::FileReference::vector &refs) -{ - for (auto const &I : project->targets()) { - if (I->name() != target) - continue; - - for (auto const &J : I->buildPhases()) { - switch (J->type()) { - case PBX::BuildPhase::Type::Headers: - { - auto BP = static_cast (J.get()); - if (BP) { - for (auto const &K : BP->files()) { - if (auto const &FR = K->fileRef()) { - if (FR->type() == PBX::GroupItem::Type::FileReference) { - refs.push_back(std::static_pointer_cast (FR)); - } - } - } - } - } - break; - default: - break; - } - } - } -} - -void -GetHeaderFilePaths(PBX::Project::shared_ptr const &project, - std::string const &target, std::set &paths) -{ - PBX::FileReference::vector refs; - GetHeaderFileReferences(project, target, refs); - - for (auto const &ref : refs) { - paths.insert(project->basePath() + "/" + ref->path()); - } -} - +namespace { void CompleteDump(process::User const *user, Filesystem const *filesystem, PBX::Project::shared_ptr const &project) { @@ -396,6 +239,7 @@ CompleteDump(process::User const *user, Filesystem const *filesystem, PBX::Proje } } } +} int diff --git a/Libraries/plist/CMakeLists.txt b/Libraries/plist/CMakeLists.txt index a76dfd6c9..f7665b4bb 100644 --- a/Libraries/plist/CMakeLists.txt +++ b/Libraries/plist/CMakeLists.txt @@ -95,6 +95,9 @@ else () if ("${CMAKE_SYSTEM_NAME}" MATCHES "Linux") target_compile_definitions(linenoise PRIVATE _GNU_SOURCE) endif () + if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") + target_compile_options(linenoise PRIVATE -Wno-missing-prototypes) + endif () target_link_libraries(PlistBuddy PRIVATE linenoise) target_compile_definitions(PlistBuddy PRIVATE HAVE_LINENOISE) diff --git a/Libraries/xcworkspace/Tools/dump_xcworkspace.cpp b/Libraries/xcworkspace/Tools/dump_xcworkspace.cpp index a8676e72e..a6ac2a305 100644 --- a/Libraries/xcworkspace/Tools/dump_xcworkspace.cpp +++ b/Libraries/xcworkspace/Tools/dump_xcworkspace.cpp @@ -25,6 +25,7 @@ using namespace pbxproj; using namespace libutil; +namespace { void DumpItem(xcworkspace::XC::Workspace::shared_ptr const &W, xcworkspace::XC::GroupItem const *item, size_t indent); void DumpItems(xcworkspace::XC::Workspace::shared_ptr const &W, xcworkspace::XC::GroupItem::vector const &items, size_t indent); @@ -151,6 +152,7 @@ ForEachFileRef(xcworkspace::XC::Workspace::shared_ptr const &W, { ForEachItems(W, nullptr, W->items(), cb); } +} int main(int argc, char **argv)