Commit Graph

414 Commits

Author SHA1 Message Date
Kitware Robot
0b96ae1f6a Revise C++ coding style using clang-format with "east const"
Run the `clang-format.bash` script to update all our C and C++ code to a
new style defined by `.clang-format`, now with "east const" enforcement.
Use `clang-format` version 18.

* If you reached this commit for a line in `git blame`, re-run the blame
  operation starting at the parent of this commit to see older history
  for the content.

* See the parent commit for instructions to rebase a change across this
  style transition commit.

Issue: #26123
2025-01-23 13:09:50 -05:00
Kitware Robot
b2ba64add9 Revise C++ coding style using clang-format-18
Run the `clang-format.bash` script to update all our C and C++ code to a
new style defined by `.clang-format`.  Use `clang-format` version 18.

* If you reached this commit for a line in `git blame`, re-run the blame
  operation starting at the parent of this commit to see older history
  for the content.

* See the parent commit for instructions to rebase a change across this
  style transition commit.

Fixes: #26123
2025-01-23 11:43:06 -05:00
Brad King
5aed3ee49d cmSystemTools: Add GetLogicalWorkingDirectory
Track the current working directory with symbolic links preserved.
2024-11-03 08:26:36 -05:00
Vitaly Stakhovsky
58da4aa47d Source: Avoid comparing pointers to nullptr 2024-08-27 10:56:38 -04:00
Vitaly Stakhovsky
1a49b439a5 Source: Use cmValue::IsOn and IsOff
Speed up a bit by calling members directly.
2024-03-17 19:05:37 -04:00
Robert Maynard
d20c21a678
ccmake: Now supports the preset toolchain entry
Previously the toolchain field was ignored when passing a preset
to ccmake.
2024-01-03 14:46:33 -05:00
Brad King
241ee252ce IWYU: Update for Debian 12 CI job
`include-what-you-use` diagnostics, in practice, are specific to
the environment's compiler and standard library.  Update includes
to satisfy IWYU for our CI job under Debian 12.
2023-07-28 09:14:08 -04:00
Martin Duffy
f601a55fc2 ccmake: Additional keybindings
Adds the following keys to ccmake:
- w: writes changes to cache file and quits without generating
- N: jump to previous search result
- Home: jump to first option
- End: jump to last option
2023-06-14 14:15:52 -04:00
Brad King
71817dc37c ccmake: Tell clang-analyzer a loop body runs at least once 2023-05-22 16:51:15 -04:00
Marc Chevrier
e08ba229ee CMake code rely on cmList class for CMake lists management (part. 1) 2023-04-24 10:41:10 +02:00
Brad King
48639aa8fc clang-format.bash: Use generic clang-format attribute
Specify the clang-format version in the attribute value instead of its
name.

Issue: #24315
2023-01-18 11:48:49 -05:00
Brad King
d5d4c698e9 Merge topic 'ccmake-aix-curses'
d91d9ec431 ccmake: Restore compilation with AIX curses.h

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !8001
2022-12-08 07:58:07 -05:00
Brad King
d91d9ec431 ccmake: Restore compilation with AIX curses.h
On AIX, including `<curses.h>` includes `<term.h>` which defines
a bunch of non-prefixed, lower-case macro names.  Undefine one
that conflicts with our source code.

Fixes: #24229
2022-12-07 17:57:28 -05:00
Alex Turbov
69918b07e1 cmDocumentationEntry: Drop all user provided ctors for C++ >= 14
There is no need for them cuz:

- the last field has a default value
- all static instances use 2 arguments convertible to `std::string`
- "dynamic" instances used for _Generator_ doc entries access
  fields diectly using default constructed instance

Moreover, compiler may generate move ctor/assign when needed.
2022-11-17 16:37:12 +04:00
Alex Turbov
74b735dea8 cmDocumentation: char*[][2]cmDocumentationEntry[N]
Use fixed size arrays of `cmDocumentationEntry` items instead of
open arrays of two `char` pointers when describe program options
help screens.

Also, drop `const char*[][2]` overloads of methods of
`cmDocumentation` and `cmDocumentationSection` classes in the sake
of generic (template) appenders introduced earlier.
2022-11-17 16:37:11 +04:00
Alex Turbov
96dcfa6b44 ccmake.cxx: Use anonymous namespace instead of static 2022-11-17 16:37:11 +04:00
Juan Ramos
3c3bce133d cmake: Honor CMAKE_GENERATOR env var in --help output 2022-10-20 19:53:14 -06:00
Alex Turbov
0aed435b35 Build: Simplify configure_file() calls 2022-09-22 09:24:47 -04:00
Brad King
e5530f3d97 Merge topic 'ccmake-fix-pdcurses-windows'
a78d10220c ccmake: Fix mangled configuration log with PDCurses on Windows

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !7458
2022-07-07 09:13:13 -04:00
Duncan Ogilvie
a78d10220c ccmake: Fix mangled configuration log with PDCurses on Windows
This fix seems to work on both Windows and Ubuntu (WSL).

Issue: #18053
2022-07-06 12:14:47 -04:00
Sean McBride
d5694e4623 Source: Replace uses of sprintf with safer snprintf 2022-06-22 08:59:40 -04:00
Brad King
eccd0b92b6 Source: Tell Git not to check whitespace in third-party curses form code 2022-06-22 08:59:40 -04:00
FeRD (Frank Dana)
98a10290a8 cmSystemTools: Fix 'ErrorOccurred' spelling
Rename the booleans 's_ErrorOccured' and 's_FatalErrorOccured' to
's_ErrorOccurred' and 's_FatalErrorOccurred', respectively.

Rename the getters and setters to 'Get[Fatal]ErrorOccurred' and
'Set[Fatal]ErrorOccurred', and fix all uses across the codebase.
2022-06-13 09:05:24 -04:00
Ben Boeckel
aa3649eb04 clang-tidy: fix performance-unnecessary-copy-initialization lints 2022-05-24 09:09:44 -04:00
Ben Boeckel
6ff03d463f clang-tidy: address google-readability-casting lints
At least those involving `static_cast`.
2022-05-24 09:09:43 -04:00
Brad King
114acce9a1 Merge topic 'ccmake-fix-infinite-loop-search'
432a8ab739 ccmake: Fix infinite loop during invalid search

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !7269
2022-05-18 08:43:31 -04:00
Martin Duffy
432a8ab739 ccmake: Fix infinite loop during invalid search
Fix issue introduced in commit 2defe9ff95 (ccmake: Fix crash when
deleting all cache entries, 2022-05-12).

Leaving the Empty Cache widget always on the Entry list had unforeseen
consequences, including that it caused an infinite loop when searching
for a string that did not match any variables.
2022-05-18 08:04:10 -04:00
Brad King
57559d2848 Merge topic 'ccmake-delete-cache'
2defe9ff95 ccmake: Fix crash when deleting all cache entries
e1c85e29f4 ccmake: Move Initialization of Fields Inline

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !7257
2022-05-13 08:45:51 -04:00
Martin Duffy
2defe9ff95 ccmake: Fix crash when deleting all cache entries
Prevents crash when deleting all cache entries.
Additionally, if advanced entries are hidden, no longer show the first advanced
entry when deleting all visible entries.

Fixes: #23499
2022-05-12 16:43:15 -04:00
Martin Duffy
e1c85e29f4 ccmake: Move Initialization of Fields Inline
Move initialization of simple fields in cmCursesMainForm inline.
2022-05-12 16:40:58 -04:00
Martin Duffy
0354865061 ccmake: Allow Vim keys in cmCursesLongMessageForm
Added support for navigation of cmCursesLongMessageForm with j and k
which affects the help and log screens.
These keys were already supported for cmCursesMainForm since commit
e34e9c2705 (ccmake: Add VIM-like bindings for navigation, 2016-07-21,
v3.7.0-rc1~295^2), adding them here for consistency.

Fixes: #5233
2022-04-07 15:06:35 -04:00
Dimitris Apostolou
cf204f209e ccmake: Fix typo in curses form comment 2022-02-17 08:55:56 -05:00
Aaron Liu
24da80b70a Utilities: Suppress warnings in third-party code with IBMClang 2022-01-27 09:38:01 -05:00
Duncan Ogilvie
9278c6e01a ccmake: Add Windows support using PDCurses 2022-01-18 16:35:39 -05:00
Duncan Ogilvie
b97c12babb ccmake: Refactor resizing logic into cmCursesForm 2022-01-18 16:35:10 -05:00
Brad King
a956be4847 Merge topic 'warnings-cleanup'
7e4e192ce2 Source: fix clang-tidy modernize-redundant-void-arg warning
8d671dd94c Source: fix more -Wmissing-prototypes warnings
1cf14f8c03 Source: fix many -Wmissing-prototypes warnings by marking functions static
319944b3d2 Source: fix some -Wunused-macros warnings
5257d9e71a Source: fix only -Wshorten-64-to-32 warning with explicit cast

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !6648
2021-10-27 09:24:54 -04:00
Brad King
9bb7982a15 Merge topic 'purge-sprintf'
b7e9cd05cd Replace the only non-standard _snprintf with snprintf
5ba6e8ac59 Source: Replace most calls to sprintf with snprintf

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6649
2021-10-27 09:23:17 -04:00
Sean McBride
5ba6e8ac59 Source: Replace most calls to sprintf with snprintf 2021-10-25 18:23:13 -04:00
Sean McBride
1cf14f8c03 Source: fix many -Wmissing-prototypes warnings by marking functions static 2021-10-25 12:27:09 -04:00
Rose
dd918c517d Source: Simplify some boolean expressions 2021-10-23 11:30:27 -04:00
makise-homura
e5d9fce03f LCC: Add dedicated support for MCST LCC compiler
Divert LCC compiler as a new one, instead of treating it as GNU.

Since old times, Elbrus C/C++/Fortran Compiler (LCC) by MCST has been
passing checks for GNU compilers, so it has been identified as GNU.
Now, with intent of seriously upstreaming its support, it has been
added as a separate LCC compiler, and its version displays not a
supported GCC version, but LCC version itself (e.g. LCC 1.25.19 instead
of GNU 7.3.0).

This commit adds its support for detection, and also converts basically
every check like 'is this compiler GNU?' to 'is this compiler GNU or
LCC?'. The only places where this check is untouched, is where it
regards other platforms where LCC is unavailable (primarily non-Linux),
and where it REALLY differs from GNU compiler.

Note: this transition may break software that are already ported to
Elbrus, but hardly relies that LCC will be detected as GNU; still such
software is not known.
2021-10-15 05:05:19 +03:00
Marc Chevrier
cc56dc7468 Rename cmProp in cmValue 2021-09-21 17:14:04 +02:00
Marius Messerschmidt
bceb8e2ed2 cmMessenger: Pass title inside a metadata structure 2021-05-19 09:06:27 -04:00
Brad King
408e6d6185 Utilities: Suppress warnings in third-party code with NVHPC 2021-04-20 11:44:25 -04:00
Brad King
87909f0600 Utilities: Suppress warnings in third-party code when using IntelLLVM 2021-01-28 09:07:00 -05:00
Ben Boeckel
cdfc4e3195 clang-tidy: fix readability-qualified-auto warnings 2021-01-27 08:45:45 -05:00
Kitware Robot
bdca8b01d2 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.
2020-09-03 09:30:21 -04:00
Brad King
16accdc76e ccmake: suppress warnings in third-party form code 2020-08-18 17:09:23 -04:00
Jean-Christophe Fillion-Robin
207373802e Fix typos identified using codespell
See https://github.com/codespell-project/codespell#readme

The following command was used:

```
codespell -q6 --skip="\
.git,\
*.json,\
./Copyright.txt,\
./Help/command/foreach.rst,\
./Help/prop_test/REQUIRED_FILES.rst,\
./Help/variable/CTEST_COVERAGE_COMMAND.rst,\
./Modules/CMakeCheckCompilerFlagCommonPatterns.cmake,\
./Modules/CMakeRCInformation.cmake,\
./Modules/Internal/CPack/NSIS.template.in,\
./Modules/FindMatlab.cmake,\
./Modules/MatlabTestsRedirect.cmake,\
./Modules/Platform/Windows-Clang.cmake,\
./Modules/Platform/Windows-Intel-Fortran.cmake,\
./Modules/Platform/Windows-MSVC.cmake,\
./Source/CMakeVersion.cmake,\
./Source/cmConvertMSBuildXMLToJSON.py,\
./Source/cmCreateTestSourceList.cxx,\
./Source/cmGlobalVisualStudio10Generator.cxx,\
./Source/cmExportBuildFileGenerator.cxx,\
./Source/cmExportInstallAndroidMKGenerator.cxx,\
./Source/cmExportInstallFileGenerator.cxx,\
./Source/cmExportSet.cxx,\
./Source/cmExportTryCompileFileGenerator.cxx,\
./Source/cmFindPackageCommand.cxx,\
./Source/cmInstallCommand.cxx,\
./Source/cmGeneratorExpressionLexer.cxx,\
./Source/cmLocalVisualStudio7Generator.cxx,\
./Source/cmOrderDirectories.cxx,\
./Source/cmTarget.cxx,\
./Source/kwsys/*,\
./Source/QtDialog/CMakeSetupDialog.ui,\
./Source/CPack/WiX/cmWIXRichTextFormatWriter.cxx,\
./Source/CTest/cmParseCoberturaCoverage.h,\
./Tests/CMakeTests/ImplicitLinkInfoTest.cmake.in,\
./Tests/RunCMake/CPack/tests/DMG_SLA/English.license.rtf,\
./Tests/RunCMake/CPack/tests/DMG_SLA/German.license.txt,\
./Tests/RunCMake/CPack/tests/DMG_SLA/German.menu.txt,\
./Tests/RunCMake/GoogleTest/xml_output.cpp,\
./Tests/RunCMake/Make/TargetMessages*,\
./Utilities/*,\
" \
-L "\
dependees,\
endwhile,\
fo,\
filetest,\
helpfull,\
nd,\
objext,\
stoll,\
supercedes,\
superceded,\
vas,\
varn,\
"
```
2020-07-22 12:44:47 -04:00
Bartosz Kosiorek
19689d34e6 ccmake: Display an error and interrupt execution if ncurses failed 2020-06-11 07:24:05 -04:00