Commit e1c77472 authored by Brad King's avatar Brad King

Format include directive blocks and ordering with clang-format

Sort include directives within each block (separated by a blank line) in
lexicographic order (except to prioritize `sys/types.h` first).  First
run `clang-format` with the config file:

    ---
    SortIncludes: false
    ...

Commit the result temporarily.  Then run `clang-format` again with:

    ---
    SortIncludes: true
    IncludeCategories:
      - Regex:    'sys/types.h'
        Priority: -1
    ...

Commit the result temporarily.  Start a new branch and cherry-pick the
second commit.  Manually resolve conflicts to preserve indentation of
re-ordered includes.  This cleans up the include ordering without
changing any other style.

Use the following command to run `clang-format`:

    $ git ls-files -z -- \
        '*.c' '*.cc' '*.cpp' '*.cxx' '*.h' '*.hh' '*.hpp' '*.hxx' |
      egrep -z -v '(Lexer|Parser|ParserHelper)\.' |
      egrep -z -v '^Source/cm_sha2' |
      egrep -z -v '^Source/(kwsys|CursesDialog/form)/' |
      egrep -z -v '^Utilities/(KW|cm).*/' |
      egrep -z -v '^Tests/Module/GenerateExportHeader' |
      egrep -z -v '^Tests/RunCMake/CommandLine/cmake_depends/test_UTF-16LE.h' |
      xargs -0 clang-format -i

This selects source files that do not come from a third-party.
Inspired-by: Daniel Pfeifer's avatarDaniel Pfeifer <daniel@pfeifer-mail.de>
parent 180538c7
#include <stdio.h>
#include <pthread.h>
#include <stdio.h>
#include <unistd.h>
void* runner(void*);
......
......@@ -12,24 +12,24 @@
#include "cmCPackIFWGenerator.h"
#include "cmCPackIFWPackage.h"
#include "cmCPackIFWInstaller.h"
#include "cmCPackIFWPackage.h"
#include <CPack/cmCPackLog.h>
#include <CPack/cmCPackComponentGroup.h>
#include <CPack/cmCPackLog.h>
#include <cmsys/SystemTools.hxx>
#include <cmsys/Glob.hxx>
#include <cmsys/Directory.hxx>
#include <cmsys/Glob.hxx>
#include <cmsys/RegularExpression.hxx>
#include <cmsys/SystemTools.hxx>
#include <cmGeneratedFileStream.h>
#include <cmGlobalGenerator.h>
#include <cmSystemTools.h>
#include <cmMakefile.h>
#include <cmGeneratedFileStream.h>
#include <cmXMLWriter.h>
#include <cmVersionConfig.h>
#include <cmSystemTools.h>
#include <cmTimestamp.h>
#include <cmVersionConfig.h>
#include <cmXMLWriter.h>
//----------------------------------------------------------------------------
cmCPackIFWGenerator::cmCPackIFWGenerator()
......
......@@ -15,8 +15,8 @@
#include <CPack/cmCPackGenerator.h>
#include "cmCPackIFWPackage.h"
#include "cmCPackIFWInstaller.h"
#include "cmCPackIFWPackage.h"
class cmXMLWriter;
......
......@@ -9,9 +9,9 @@
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the License for more information.
============================================================================*/
#include <cmsys/SystemTools.hxx>
#include <cmsys/Process.h>
#include <cmsys/FStream.hxx>
#include <cmsys/Process.h>
#include <cmsys/SystemTools.hxx>
#include <iostream>
......
......@@ -12,23 +12,23 @@
#include "cmCPackWIXGenerator.h"
#include <cmSystemTools.h>
#include <cmGeneratedFileStream.h>
#include <CPack/cmCPackComponentGroup.h>
#include <CPack/cmCPackLog.h>
#include <cmCryptoHash.h>
#include <cmGeneratedFileStream.h>
#include <cmInstalledFile.h>
#include <CPack/cmCPackLog.h>
#include <CPack/cmCPackComponentGroup.h>
#include <cmSystemTools.h>
#include "cmWIXSourceWriter.h"
#include "cmWIXDirectoriesSourceWriter.h"
#include "cmWIXFeaturesSourceWriter.h"
#include "cmWIXFilesSourceWriter.h"
#include "cmWIXRichTextFormatWriter.h"
#include "cmWIXSourceWriter.h"
#include <cmsys/SystemTools.hxx>
#include <cmsys/Directory.hxx>
#include <cmsys/Encoding.hxx>
#include <cmsys/FStream.hxx>
#include <cmsys/SystemTools.hxx>
#include <rpc.h> // for GUID generation
......
......@@ -18,8 +18,8 @@
#include "cmWIXPatch.h"
#include "cmWIXShortcut.h"
#include <string>
#include <map>
#include <string>
class cmWIXSourceWriter;
class cmWIXDirectoriesSourceWriter;
......
......@@ -15,8 +15,8 @@
#include "cmWIXSourceWriter.h"
#include <cmInstalledFile.h>
#include <CPack/cmCPackLog.h>
#include <cmInstalledFile.h>
class cmWIXAccessControlList
{
......
......@@ -15,8 +15,8 @@
#include "cmWIXSourceWriter.h"
#include "cmWIXShortcut.h"
#include "cmWIXPatch.h"
#include "cmWIXShortcut.h"
#include <CPack/cmCPackGenerator.h>
......
......@@ -13,8 +13,8 @@
#ifndef cmWIXPatch_h
#define cmWIXPatch_h
#include "cmWIXSourceWriter.h"
#include "cmWIXPatchParser.h"
#include "cmWIXSourceWriter.h"
#include <string>
......
......@@ -15,9 +15,9 @@
#include <cmInstalledFile.h>
#include <string>
#include <map>
#include <set>
#include <string>
#include <vector>
class cmWIXFilesSourceWriter;
......
......@@ -17,8 +17,8 @@
#include <cmsys/FStream.hxx>
#include <vector>
#include <string>
#include <vector>
/** \class cmWIXSourceWriter
* \brief Helper class to generate XML WiX source files
......
......@@ -12,17 +12,17 @@
#include "cmCPackArchiveGenerator.h"
#include "cmake.h"
#include "cmCPackLog.h"
#include "cmGeneratedFileStream.h"
#include "cmGlobalGenerator.h"
#include "cmSystemTools.h"
#include "cmMakefile.h"
#include "cmGeneratedFileStream.h"
#include "cmCPackLog.h"
#include "cmSystemTools.h"
#include "cmake.h"
#include <errno.h>
#include <cmsys/SystemTools.hxx>
#include <cmsys/Directory.hxx>
#include <cm_libarchive.h>
#include <cmsys/Directory.hxx>
#include <cmsys/SystemTools.hxx>
//----------------------------------------------------------------------
cmCPackArchiveGenerator::cmCPackArchiveGenerator(cmArchiveWrite::Compress t,
......
......@@ -14,8 +14,8 @@
#include "cmSystemTools.h"
#include <vector>
#include <string>
#include <vector>
//----------------------------------------------------------------------
unsigned long cmCPackComponent::GetInstalledSize(
......
......@@ -12,12 +12,12 @@
#include "cmCPackCygwinBinaryGenerator.h"
#include "cmake.h"
#include "cmCPackLog.h"
#include "cmGeneratedFileStream.h"
#include "cmGlobalGenerator.h"
#include "cmSystemTools.h"
#include "cmMakefile.h"
#include "cmGeneratedFileStream.h"
#include "cmCPackLog.h"
#include "cmSystemTools.h"
#include "cmake.h"
#include <cmsys/SystemTools.hxx>
......
......@@ -12,12 +12,12 @@
#include "cmCPackCygwinSourceGenerator.h"
#include "cmake.h"
#include "cmCPackLog.h"
#include "cmGeneratedFileStream.h"
#include "cmGlobalGenerator.h"
#include "cmSystemTools.h"
#include "cmMakefile.h"
#include "cmGeneratedFileStream.h"
#include "cmCPackLog.h"
#include "cmSystemTools.h"
#include "cmake.h"
#include <cmsys/SystemTools.hxx>
......@@ -25,8 +25,8 @@
// system tools because it is not implemented robustly enough to move
// files across directories.
#ifdef _WIN32
# include <windows.h>
# include <sys/stat.h>
# include <windows.h>
#endif
//----------------------------------------------------------------------
......
......@@ -12,14 +12,14 @@
#include "cmCPackDebGenerator.h"
#include "cmSystemTools.h"
#include "cmMakefile.h"
#include "cmGeneratedFileStream.h"
#include "cmCPackLog.h"
#include "cmArchiveWrite.h"
#include "cmCPackLog.h"
#include "cmGeneratedFileStream.h"
#include "cmMakefile.h"
#include "cmSystemTools.h"
#include <cmsys/SystemTools.hxx>
#include <cmsys/Glob.hxx>
#include <cmsys/SystemTools.hxx>
#include <limits.h> // USHRT_MAX
#include <sys/stat.h>
......@@ -764,8 +764,8 @@ std::string cmCPackDebGenerator::GetComponentInstallDirNameSuffix(
#include <sys/stat.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <string.h>
#define ARMAG "!<arch>\n" /* ar "magic number" */
#define SARMAG 8 /* strlen(ARMAG); */
......
......@@ -13,11 +13,11 @@
#include "cmCPackDragNDropGenerator.h"
#include "cmCPackLog.h"
#include "cmSystemTools.h"
#include "cmGeneratedFileStream.h"
#include "cmSystemTools.h"
#include <cmsys/RegularExpression.hxx>
#include <cmsys/FStream.hxx>
#include <cmsys/RegularExpression.hxx>
#include <iomanip>
......
......@@ -12,18 +12,18 @@
#include "cmCPackGenerator.h"
#include "cmMakefile.h"
#include "cmCPackComponentGroup.h"
#include "cmCPackLog.h"
#include "cmake.h"
#include "cmGlobalGenerator.h"
#include "cmGeneratedFileStream.h"
#include "cmCPackComponentGroup.h"
#include "cmGlobalGenerator.h"
#include "cmMakefile.h"
#include "cmXMLSafe.h"
#include "cmake.h"
#include <cmsys/SystemTools.hxx>
#include <cmsys/Glob.hxx>
#include <cmsys/FStream.hxx>
#include <algorithm>
#include <cmsys/FStream.hxx>
#include <cmsys/Glob.hxx>
#include <cmsys/SystemTools.hxx>
#include <list>
#if defined(__HAIKU__)
......
......@@ -12,22 +12,22 @@
#include "cmCPackGeneratorFactory.h"
#include "IFW/cmCPackIFWGenerator.h"
#include "cmCPack7zGenerator.h"
#include "cmCPackGenerator.h"
#include "cmCPackNSISGenerator.h"
#include "cmCPackSTGZGenerator.h"
#include "cmCPackTGZGenerator.h"
#include "cmCPackTXZGenerator.h"
#include "cmCPackTarBZip2Generator.h"
#include "cmCPackTarCompressGenerator.h"
#include "cmCPackZIPGenerator.h"
#include "cmCPack7zGenerator.h"
#include "cmCPackSTGZGenerator.h"
#include "cmCPackNSISGenerator.h"
#include "IFW/cmCPackIFWGenerator.h"
#ifdef __APPLE__
# include "cmCPackDragNDropGenerator.h"
# include "cmCPackBundleGenerator.h"
# include "cmCPackPackageMakerGenerator.h"
# include "cmCPackOSXX11Generator.h"
# include "cmCPackBundleGenerator.h"
# include "cmCPackDragNDropGenerator.h"
# include "cmCPackOSXX11Generator.h"
# include "cmCPackPackageMakerGenerator.h"
#endif
#ifdef __CYGWIN__
......@@ -45,8 +45,8 @@
# include "WiX/cmCPackWIXGenerator.h"
#endif
#include "cmCPackLog.h"
#include "cmAlgorithms.h"
#include "cmCPackLog.h"
//----------------------------------------------------------------------
......
......@@ -12,17 +12,17 @@
#include "cmCPackNSISGenerator.h"
#include "cmCPackComponentGroup.h"
#include "cmCPackLog.h"
#include "cmGeneratedFileStream.h"
#include "cmGlobalGenerator.h"
#include "cmSystemTools.h"
#include "cmMakefile.h"
#include "cmGeneratedFileStream.h"
#include "cmCPackLog.h"
#include "cmCPackComponentGroup.h"
#include "cmSystemTools.h"
#include <cmsys/SystemTools.hxx>
#include <cmsys/Glob.hxx>
#include <cmsys/Directory.hxx>
#include <cmsys/Glob.hxx>
#include <cmsys/RegularExpression.hxx>
#include <cmsys/SystemTools.hxx>
/* NSIS uses different command line syntax on Windows and others */
#ifdef _WIN32
......
......@@ -12,15 +12,15 @@
#include "cmCPackOSXX11Generator.h"
#include "cmake.h"
#include "cmCPackLog.h"
#include "cmGeneratedFileStream.h"
#include "cmGlobalGenerator.h"
#include "cmSystemTools.h"
#include "cmMakefile.h"
#include "cmGeneratedFileStream.h"
#include "cmCPackLog.h"
#include "cmSystemTools.h"
#include "cmake.h"
#include <cmsys/SystemTools.hxx>
#include <cmsys/Glob.hxx>
#include <cmsys/SystemTools.hxx>
#include <sys/stat.h>
//----------------------------------------------------------------------
......
......@@ -11,17 +11,17 @@
============================================================================*/
#include "cmCPackPackageMakerGenerator.h"
#include "cmake.h"
#include "cmGlobalGenerator.h"
#include "cmSystemTools.h"
#include "cmMakefile.h"
#include "cmGeneratedFileStream.h"
#include "cmCPackComponentGroup.h"
#include "cmCPackLog.h"
#include "cmGeneratedFileStream.h"
#include "cmGlobalGenerator.h"
#include "cmMakefile.h"
#include "cmSystemTools.h"
#include "cmake.h"
#include <cmsys/SystemTools.hxx>
#include <cmsys/Glob.hxx>
#include <cmsys/FStream.hxx>
#include <cmsys/Glob.hxx>
#include <cmsys/SystemTools.hxx>
#include <assert.h>
......
......@@ -12,14 +12,14 @@
#include "cmCPackSTGZGenerator.h"
#include "cmake.h"
#include "cmCPackLog.h"
#include "cmGlobalGenerator.h"
#include "cmSystemTools.h"
#include "cmMakefile.h"
#include "cmCPackLog.h"
#include "cmSystemTools.h"
#include "cmake.h"
#include <cmsys/FStream.hxx>
#include <sys/types.h>
#include <cmsys/FStream.hxx>
#include <sys/stat.h>
//----------------------------------------------------------------------
......
......@@ -12,19 +12,19 @@
#include "cmSystemTools.h"
// Need these for documentation support.
#include "cmake.h"
#include "cmDocumentation.h"
#include "cmCPackGeneratorFactory.h"
#include "cmCPackGenerator.h"
#include "cmake.h"
#include "cmCPackGeneratorFactory.h"
#include "cmDocumentation.h"
#include "cmGlobalGenerator.h"
#include "cmMakefile.h"
#include "cmake.h"
#include "cmake.h"
#include "cmCPackLog.h"
#include <cmsys/CommandLineArguments.hxx>
#include <cmsys/SystemTools.hxx>
#include <cmsys/Encoding.hxx>
#include <cmsys/SystemTools.hxx>
//----------------------------------------------------------------------------
static const char * cmDocumentationName[][2] =
......
......@@ -12,9 +12,9 @@
#include "cmCTestBatchTestHandler.h"
#include "cmCTest.h"
#include "cmProcess.h"
#include "cmStandardIncludes.h"
#include "cmCTest.h"
#include "cmSystemTools.h"
#include <stdlib.h>
......
......@@ -15,9 +15,9 @@
#include <cmStandardIncludes.h>
#include <cmCTestTestHandler.h>
#include <cmCTestMultiProcessHandler.h>
#include <cmCTestRunTest.h>
#include <cmCTestTestHandler.h>
#include <cmsys/FStream.hxx>
/** \class cmCTestBatchTestHandler
......
......@@ -12,12 +12,12 @@
#include "cmCTestBuildAndTestHandler.h"
#include "cmSystemTools.h"
#include "cmCTest.h"
#include "cmake.h"
#include "cmCTestTestHandler.h"
#include "cmGlobalGenerator.h"
#include "cmSystemTools.h"
#include "cmake.h"
#include <cmsys/Process.h>
#include "cmCTestTestHandler.h"
//----------------------------------------------------------------------
cmCTestBuildAndTestHandler::cmCTestBuildAndTestHandler()
......
......@@ -12,10 +12,10 @@
#include "cmCTestBuildCommand.h"
#include "cmCTest.h"
#include "cmCTestGenericHandler.h"
#include "cmCTestBuildHandler.h"
#include "cmake.h"
#include "cmCTestGenericHandler.h"
#include "cmGlobalGenerator.h"
#include "cmake.h"
//----------------------------------------------------------------------------
......
......@@ -12,29 +12,29 @@
#include "cmCTestBuildHandler.h"
#include "cmAlgorithms.h"
#include "cmCTest.h"
#include "cmake.h"
#include "cmMakefile.h"
#include "cmGlobalGenerator.h"
#include "cmFileTimeComparison.h"
#include "cmGeneratedFileStream.h"
#include "cmGlobalGenerator.h"
#include "cmMakefile.h"
#include "cmXMLWriter.h"
#include "cmFileTimeComparison.h"
#include "cmAlgorithms.h"
#include "cmake.h"
//#include <cmsys/RegularExpression.hxx>
#include <cmsys/Process.h>
#include <cmsys/Directory.hxx>
#include <cmsys/FStream.hxx>
#include <cmsys/Process.h>
// used for sleep
#ifdef _WIN32
#include "windows.h"
#endif
#include <float.h>
#include <math.h>
#include <stdlib.h>
#include <time.h>
#include <math.h>
#include <float.h>
static const char* cmCTestErrorMatches[] = {
......
......@@ -15,8 +15,8 @@
#include "cmSystemTools.h"
#include "cmXMLWriter.h"
#include <cmsys/RegularExpression.hxx>
#include <cmsys/FStream.hxx>
#include <cmsys/RegularExpression.hxx>
//----------------------------------------------------------------------------
cmCTestCVS::cmCTestCVS(cmCTest* ct, std::ostream& log): cmCTestVC(ct, log)
......
......@@ -11,9 +11,9 @@
============================================================================*/
#include "cmCTestConfigureCommand.h"
#include "cmGlobalGenerator.h"
#include "cmCTest.h"
#include "cmCTestGenericHandler.h"
#include "cmGlobalGenerator.h"
cmCTestConfigureCommand::cmCTestConfigureCommand()
{
......
......@@ -14,8 +14,8 @@
#include "cmCTest.h"
#include "cmGeneratedFileStream.h"
#include "cmake.h"
#include "cmXMLWriter.h"
#include "cmake.h"
#include <cmsys/Process.h>
......
......@@ -11,28 +11,28 @@
============================================================================*/
#include "cmCTestCoverageHandler.h"
#include "cmParsePHPCoverage.h"
#include "cmCTest.h"
#include "cmGeneratedFileStream.h"
#include "cmMakefile.h"
#include "cmParseBlanketJSCoverage.h"
#include "cmParseCacheCoverage.h"
#include "cmParseCoberturaCoverage.h"
#include "cmParseDelphiCoverage.h"
#include "cmParseGTMCoverage.h"
#include "cmParseCacheCoverage.h"
#include "cmParseJacocoCoverage.h"
#include "cmParseDelphiCoverage.h"
#include "cmParseBlanketJSCoverage.h"
#include "cmCTest.h"
#include "cmake.h"
#include "cmMakefile.h"
#include "cmParsePHPCoverage.h"
#include "cmSystemTools.h"
#include "cmGeneratedFileStream.h"
#include "cmXMLWriter.h"
#include "cmake.h"
#include <cmsys/FStream.hxx>
#include <cmsys/Glob.hxx>
#include <cmsys/Process.h>
#include <cmsys/RegularExpression.hxx>
#include <cmsys/Glob.hxx>
#include <cmsys/FStream.hxx>
#include <stdlib.h>
#include <math.h>
#include <float.h>