Modernize: Use #pragma once in all header files

#pragma once is a widely supported compiler pragma, even though it is
not part of the C++ standard. Many of the issues keeping #pragma once
from being standardized (distributed filesystems, build farms, hard
links, etc.) do not apply to CMake - it is easy to build CMake on a
single machine. CMake also does not install any header files which can
be consumed by other projects (though cmCPluginAPI.h has been
deliberately omitted from this conversion in case anyone is still using
it.) Finally, #pragma once has been required to build CMake since at
least August 2017 (7f29bbe6 enabled server mode unconditionally, which
had been using #pragma once since September 2016 (b13d3e0d)). The fact
that we now require C++11 filters out old compilers, and it is unlikely
that there is a compiler which supports C++11 but does not support
#pragma once.
This commit is contained in:
Kitware Robot
2020-08-29 16:27:37 -04:00
committed by Kyle Edwards
parent 093ba4061d
commit bdca8b01d2
508 changed files with 508 additions and 2011 deletions
+1 -4
View File
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
#ifndef cmCPackIFWCommon_h
#define cmCPackIFWCommon_h
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -77,5 +76,3 @@ protected:
cmCPackLog_msg.str().c_str()); \
} \
} while (false)
#endif // cmCPackIFWCommon_h
+1 -4
View File
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
#ifndef cmCPackIFWGenerator_h
#define cmCPackIFWGenerator_h
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -152,5 +151,3 @@ private:
std::vector<std::string> PkgsDirsVector;
std::vector<std::string> RepoDirsVector;
};
#endif
+1 -4
View File
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
#ifndef cmCPackIFWInstaller_h
#define cmCPackIFWInstaller_h
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -132,5 +131,3 @@ protected:
void printSkippedOptionWarning(const std::string& optionName,
const std::string& optionValue);
};
#endif // cmCPackIFWInstaller_h
+1 -4
View File
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
#ifndef cmCPackIFWPackage_h
#define cmCPackIFWPackage_h
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -149,5 +148,3 @@ public:
// Patch to package directory
std::string Directory;
};
#endif // cmCPackIFWPackage_h
+1 -4
View File
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
#ifndef cmCPackIFWRepository_h
#define cmCPackIFWRepository_h
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -84,5 +83,3 @@ public:
RepositoriesVector RepositoryUpdate;
std::string Directory;
};
#endif // cmCPackIFWRepository_h
+1 -4
View File
@@ -1,12 +1,9 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
#ifndef cmCMakeToWixPath_h
#define cmCMakeToWixPath_h
#pragma once
#include "cmConfigure.h" //IWYU pragma: keep
#include <string>
std::string CMakeToWixPath(const std::string& cygpath);
#endif // cmCMakeToWixPath_h
+1 -4
View File
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
#ifndef cmCPackWIXGenerator_h
#define cmCPackWIXGenerator_h
#pragma once
#include <map>
#include <memory>
@@ -171,5 +170,3 @@ private:
cmWIXSourceWriter::GuidType ComponentGuidType;
};
#endif
+1 -4
View File
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
#ifndef cmWIXAccessControlList_h
#define cmWIXAccessControlList_h
#pragma once
#include "cmCPackLog.h"
#include "cmInstalledFile.h"
@@ -29,5 +28,3 @@ private:
cmInstalledFile const& InstalledFile;
cmWIXSourceWriter& SourceWriter;
};
#endif
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
#ifndef cmWIXDirectoriesSourceWriter_h
#define cmWIXDirectoriesSourceWriter_h
#pragma once
#include <string>
@@ -29,5 +28,3 @@ public:
void EndInstallationPrefixDirectory(size_t size);
};
#endif
+1 -4
View File
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
#ifndef cmWIXFeaturesSourceWriter_h
#define cmWIXFeaturesSourceWriter_h
#pragma once
#include "cmCPackGenerator.h"
#include "cmWIXPatch.h"
@@ -27,5 +26,3 @@ public:
void EmitComponentRef(std::string const& id);
};
#endif
+1 -4
View File
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
#ifndef cmWIXFilesSourceWriter_h
#define cmWIXFilesSourceWriter_h
#pragma once
#include "cmCPackGenerator.h"
#include "cmWIXPatch.h"
@@ -37,5 +36,3 @@ public:
std::string const& filePath, cmWIXPatch& patch,
cmInstalledFile const* installedFile);
};
#endif
+1 -4
View File
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
#ifndef cmWIXPatch_h
#define cmWIXPatch_h
#pragma once
#include <string>
@@ -33,5 +32,3 @@ private:
cmWIXPatchParser::fragment_map_t Fragments;
};
#endif
+1 -4
View File
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
#ifndef cmCPackWIXPatchParser_h
#define cmCPackWIXPatchParser_h
#pragma once
#include <map>
#include <memory>
@@ -91,5 +90,3 @@ private:
std::vector<cmWIXPatchElement*> ElementStack;
};
#endif
+1 -4
View File
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
#ifndef cmWIXRichTextFormatWriter_h
#define cmWIXRichTextFormatWriter_h
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -42,5 +41,3 @@ private:
cmsys::ofstream File;
};
#endif
+1 -4
View File
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
#ifndef cmWIXShortcut_h
#define cmWIXShortcut_h
#pragma once
#include <map>
#include <set>
@@ -56,5 +55,3 @@ private:
shortcut_type_map_t Shortcuts;
shortcut_id_map_t EmptyIdMap;
};
#endif
+1 -4
View File
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
#ifndef cmWIXSourceWriter_h
#define cmWIXSourceWriter_h
#pragma once
#include <string>
#include <vector>
@@ -76,5 +75,3 @@ private:
GuidType ComponentGuidType;
};
#endif
+1 -4
View File
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
#ifndef cmCPackArchiveGenerator_h
#define cmCPackArchiveGenerator_h
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -93,5 +92,3 @@ private:
std::string ArchiveFormat;
std::string OutputExtension;
};
#endif
+1 -4
View File
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
#ifndef cmCPackBundleGenerator_h
#define cmCPackBundleGenerator_h
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -33,5 +32,3 @@ protected:
std::string InstallPrefix;
};
#endif
+1 -4
View File
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
#ifndef cmCPackComponentGroup_h
#define cmCPackComponentGroup_h
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -167,5 +166,3 @@ public:
/// The list of components.
std::vector<cmCPackComponent*> Components;
};
#endif
+1 -4
View File
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
#ifndef cmCPackCygwinBinaryGenerator_h
#define cmCPackCygwinBinaryGenerator_h
#pragma once
#include "cmCPackArchiveGenerator.h"
@@ -25,5 +24,3 @@ protected:
virtual const char* GetOutputExtension();
std::string OutputExtension;
};
#endif
+1 -4
View File
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
#ifndef cmCPackCygwinSourceGenerator_h
#define cmCPackCygwinSourceGenerator_h
#pragma once
#include "cmCPackArchiveGenerator.h"
@@ -27,5 +26,3 @@ protected:
std::string InstallPrefix;
std::string OutputExtension;
};
#endif
+1 -4
View File
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
#ifndef cmCPackDebGenerator_h
#define cmCPackDebGenerator_h
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -69,5 +68,3 @@ private:
std::vector<std::string> packageFiles;
};
#endif
+1 -4
View File
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
#ifndef cmCPackDragNDropGenerator_h
#define cmCPackDragNDropGenerator_h
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -81,5 +80,3 @@ private:
bool BreakLongLine(const std::string& line, std::vector<std::string>& lines,
std::string* error);
};
#endif
+1 -4
View File
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
#ifndef cmCPackExternalGenerator_h
#define cmCPackExternalGenerator_h
#pragma once
#include <memory>
#include <string>
@@ -86,5 +85,3 @@ private:
std::unique_ptr<cmCPackExternalVersionGenerator> Generator;
};
#endif
+1 -4
View File
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
#ifndef cmCPackFreeBSDGenerator_h
#define cmCPackFreeBSDGenerator_h
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -33,5 +32,3 @@ protected:
std::string var_lookup(const char* var_name);
void write_manifest_fields(cmGeneratedFileStream&);
};
#endif
+1 -4
View File
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
#ifndef cmCPackGenerator_h
#define cmCPackGenerator_h
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -339,5 +338,3 @@ protected:
this->Logger->Log(logType, __FILE__, __LINE__, \
cmCPackLog_msg.str().c_str()); \
} while (false)
#endif
+1 -4
View File
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
#ifndef cmCPackGeneratorFactory_h
#define cmCPackGeneratorFactory_h
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -44,5 +43,3 @@ private:
DescriptionsMap GeneratorDescriptions;
cmCPackLog* Logger;
};
#endif
+1 -4
View File
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
#ifndef cmCPackLog_h
#define cmCPackLog_h
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -139,5 +138,3 @@ inline std::ostream& operator<<(std::ostream& os, const cmCPackLogWrite& c)
os.flush();
return os;
}
#endif
+1 -4
View File
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
#ifndef cmCPackNSISGenerator_h
#define cmCPackNSISGenerator_h
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -85,5 +84,3 @@ protected:
bool Nsis64;
};
#endif
+1 -4
View File
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
#ifndef cmCPackNuGetGenerator_h
#define cmCPackNuGetGenerator_h
#pragma once
#include "cmCPackGenerator.h"
@@ -33,5 +32,3 @@ protected:
*/
void AddGeneratedPackageNames();
};
#endif
+1 -4
View File
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
#ifndef cmCPackOSXX11Generator_h
#define cmCPackOSXX11Generator_h
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -38,5 +37,3 @@ protected:
bool copyOnly = false);
std::string InstallPrefix;
};
#endif
+1 -4
View File
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
#ifndef cmCPackPKGGenerator_h
#define cmCPackPKGGenerator_h
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -94,5 +93,3 @@ protected:
// The PostFlight component when creating a metapackage
cmCPackComponent PostFlightComponent;
};
#endif
+1 -4
View File
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
#ifndef cmCPackPackageMakerGenerator_h
#define cmCPackPackageMakerGenerator_h
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -49,5 +48,3 @@ protected:
double PackageMakerVersion;
unsigned int PackageCompatibilityVersion;
};
#endif
+1 -4
View File
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
#ifndef cmCPackProductBuildGenerator_h
#define cmCPackProductBuildGenerator_h
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -49,5 +48,3 @@ protected:
const char* GetComponentScript(const char* script,
const char* script_component);
};
#endif
+1 -4
View File
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
#ifndef cmCPackRPMGenerator_h
#define cmCPackRPMGenerator_h
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -68,5 +67,3 @@ protected:
void AddGeneratedPackageNames();
};
#endif
+1 -4
View File
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
#ifndef cmCPackSTGZGenerator_h
#define cmCPackSTGZGenerator_h
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -30,5 +29,3 @@ protected:
int InitializeInternal() override;
int GenerateHeader(std::ostream* os) override;
};
#endif