Commit Graph

182 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
Vitaly Stakhovsky
58da4aa47d Source: Avoid comparing pointers to nullptr 2024-08-27 10:56:38 -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
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
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
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
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
Duncan Ogilvie
9278c6e01a ccmake: Add Windows support using PDCurses 2022-01-18 16:35:39 -05:00
Sean McBride
5ba6e8ac59 Source: Replace most calls to sprintf with snprintf 2021-10-25 18:23:13 -04:00
Marc Chevrier
cc56dc7468 Rename cmProp in cmValue 2021-09-21 17:14:04 +02:00
Ben Boeckel
cdfc4e3195 clang-tidy: fix readability-qualified-auto warnings 2021-01-27 08:45:45 -05:00
Brad King
961ca77a7a Merge topic 'gitlab-ci-ninja-multi'
e1b2c0108f gitlab-ci: add a Ninja Multi-Config test job
1e8ecfccdd gitlab-ci: also build ncurses and Qt code on Linux
95721f0a82 ci: install ncurses and Qt development into the Fedora 31 image
ed2fe558b0 CursesDialog: resolve clang-tidy warnings
44f1744bed QtDialog: avoid using deprecated APIs

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4832
2020-06-02 09:17:24 -04:00
Ben Boeckel
ed2fe558b0 CursesDialog: resolve clang-tidy warnings
Fixes:

  - unnecessary bool expression (cmCursesMainForm)
  - removes a duplicate if/else branch (RegexExplorer)
  - collapses redundant if/else branch logic (CMakeSetupDialog and
    cmCursesStringWidget)
2020-06-02 07:37:56 -04:00
Vitaly Stakhovsky
b36d1bdd9d Single location for cmProp typedef 2020-06-01 08:54:20 -04:00
Brad King
0e1313cdf4 Merge topic 'ccmake_incremental_log_display'
60bfaa8fe6 ccmake: Use incremental rendering for the logs
e9b36731e9 cmCursesLongMessageForm: Factor out helper to draw message to form

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Robert Maynard <robert.maynard@kitware.com>
Merge-request: !4573
2020-04-09 08:12:12 -04:00
Sylvain Joubert
60bfaa8fe6 ccmake: Use incremental rendering for the logs
This should avoid an exponential slowdown in the display time for
projects with lots of output.
This is still slower than cmake due to the ncurses drawing, but it should
now be O(L) in total and not O(L^2) wrt to output length.

Fixes: #20535
2020-04-08 14:40:09 -04:00
Vitaly Stakhovsky
a7f2ff16a4 cmState::GetCacheEntryProperty: return cmProp 2020-03-25 14:46:52 -04:00
Vitaly Stakhovsky
bd89133543 cmState::GetCacheEntryValue: return cmProp 2020-03-17 12:09:20 -04:00
Sylvain Joubert
b4ef7fbaa8 ccmake: Fix crash with cache entries almost the size of the window
The previous code:

if (curFieldLen < width) {
  ...
  strncpy(bar + curFieldLen + 2, help, width - curFieldLen - 2);

was not correctly guarded against cache entries whose size were exactly
1 or 2 characters short of the window size.
"if (curFieldLen - 2 < width)" would have prevented a copy of
negative/max_int characters and a subsequent crash.

The whole method was modernized with std::string instead of char*
2019-11-19 20:06:31 +01:00
Sylvain Joubert
ce99f5ee69 ccmake: Fix rendering on window resize
Repro steps: configure (without errors), the logs are displayed then the
cache is displayed again, resize the window up -> the logs are
redisplayed after resize instead of the cache

The 'CurrentForm' pointer were left pointed to the last log message
form, this resets it to the main form when configure or generate is done
2019-11-18 17:05:37 +01:00
Sylvain Joubert
88cfef0821 ccmake: redirect stdout/stderr to the displayed logs
Use cmSystemTools to report some messages.
These should now be caught and displayed properly,
both in ccmake and cmake-gui

Avoid log display flickering during processing
- Don't clear the screen each time the long message form is rendered.
  It always renders the whole screen again so clearing it only causes
  flickering.
- Add scroll down capabilities to the long message form so that it can
  draw itself directly in the correct state. This removes the need to
  programatically scroll down just after that also caused flickering.

Fixes #19882
Fixes #13288
2019-11-16 08:27:32 +01:00
Sylvain Joubert
d5d5ba3f7f ccmake: Identify the current cache entry 2019-11-04 20:06:51 +01:00
Sylvain Joubert
005aba29a1 ccmake: Improve display of the key controls
Reduce space usage and add the key to display the output
2019-11-04 18:59:20 +01:00
Sylvain Joubert
66d969fcc4 ccmake: Don't overwrite the last character of the title 2019-10-25 14:58:23 +02:00
Sylvain Joubert
1d0e557aed ccmake: Display output during configure and generate 2019-10-25 14:58:23 +02:00
Sylvain Joubert
c168e789df ccmake: Use the error display for all the logs 2019-10-25 14:58:23 +02:00
Sylvain Joubert
3300070cc2 ccmake: Display an ASCII progress bar in the status bar
The status bar is now only used to display the progress.
The status log are not shown anymore since for the most cases they went
by too quickly to be read. As for cases when a process is long enough
to display and read a log, it would probably be a previous unrelated
message.
2019-10-25 14:58:23 +02:00
Sylvain Joubert
9276beae5e ccmake: Fully clear the 1st help line when processing 2019-10-20 14:25:05 +02:00
Kitware Robot
ed98209ddc Revise include order using clang-format-6.0
Run the `clang-format.bash` script to update our C and C++ code to a new
include order `.clang-format`.  Use `clang-format` version 6.0.
2019-10-01 12:26:36 -04:00
Tushar Maheshwari
7d6e08b438 cmCursesMainForm: change Entries to object vector
- Add move constructor and move assignment operator for
`cmCursesCacheEntryComposite`.
- Transfer ownership of Entries objects to std::vector.
2019-09-27 17:18:16 +05:30
Tushar Maheshwari
bc71b253cb cmCursesCacheEntryComposite: default destructor 2019-09-26 11:10:22 -04:00
Tushar Maheshwari
36875ff419 cmCursesMainForm: cleanup manual allocation 2019-09-26 11:10:20 -04:00
Regina Pfeifer
f30523d090 clang-tidy: modernize-deprecated-headers 2019-09-16 10:11:13 -04:00
Sebastian Holtermann
9b334397f5 Source sweep: Use cmStrCat for string concatenation
This patch is generated by a python script that uses regular expressions to
search for string concatenation patterns of the kind

```
std::string str = <ARG0>;
str += <ARG1>;
str += <ARG2>;
...
```

and replaces them with a single `cmStrCat` call

```
std::string str = cmStrCat(<ARG0>, <ARG1>, <ARG2>, ...);
```

If any `<ARGX>` is itself a concatenated string of the kind

```
a + b + c + ...;
```

then `<ARGX>` is split into multiple arguments for the `cmStrCat` call.

If there's a sequence of literals in the `<ARGX>`, then all literals in the
sequence are concatenated and merged into a single literal argument for
the `cmStrCat` call.

Single character strings are converted to single char arguments for
the `cmStrCat` call.

`std::to_string(...)` wrappings are removed from `cmStrCat` arguments,
because it supports numeric types as well as string types.

`arg.substr(x)` arguments to `cmStrCat` are replaced with
`cm::string_view(arg).substr(x)`
2019-08-22 16:38:10 +02:00
Regina Pfeifer
d331021255 clang-tidy: isolate declarations for readability 2019-08-21 00:20:49 +02:00
Sebastian Holtermann
20e580be01 Source sweep: Use cmIsOn instead of cmSystemTools::IsOn
This replaces invocations of

- `cmSystemTools::IsInternallyOn` with `cmIsInternallyOn`
- `cmSystemTools::IsNOTFOUND` with `cmIsNOTFOUND`
- `cmSystemTools::IsOn` with `cmIsOn`
- `cmSystemTools::IsOff` with `cmIsOff`
2019-08-17 12:14:14 +02:00
Felix Schwitzer
aa68ce6bd4 ccmake: fix curses dialog broken by refactoring
During refactoring in commit f6291eee25 (cmCursesMainForm: Modernize
with STL and ranged-for loops, 2019-02-10) a transformation of a loop
went wrong and editing the cmake cache with ccmake no longer works.
Make ccmake work again.

Fixes: #19008
2019-03-04 09:12:41 -05:00
Artur Ryt
c28abdb5ac cmCursesMainForm: Fix lambda return type deducing warning
It was issued by sparc compiler on Solaris system
See !2947
2019-02-12 19:24:53 +01:00
Brad King
20afd497c9 Merge topic 'progress-stdstring'
950c099d83 cmake: Progress functions use `std::string` param

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2948
2019-02-12 08:30:13 -05:00
Brad King
a7a8571933 Merge topic 'modernize-cmCursesMainForm'
f6291eee25 cmCursesMainForm: Modernize with STL and ranged-for loops

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2947
2019-02-12 08:29:08 -05:00
Vitaly Stakhovsky
950c099d83 cmake: Progress functions use std::string param 2019-02-11 10:32:43 -05:00
Brad King
4b37b4f1bb Merge topic 'modernize-for-loops'
01b2d6ab74 Modernize: Use ranged for-loops when possible
15bdbec017 cmAlgorithms: Make cmRange advance/retreat safe for rvalues

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Daniel Pfeifer <daniel@pfeifer-mail.de>
Merge-request: !2901
2019-02-11 08:08:22 -05:00
Artur Ryt
f6291eee25 cmCursesMainForm: Modernize with STL and ranged-for loops 2019-02-10 19:07:50 +01:00
Artur Ryt
01b2d6ab74 Modernize: Use ranged for-loops when possible
Replaced most manual `const_iterator`-based loops and some
reverse-iterator loops with range loops.

Fixes: #18858
2019-02-07 22:39:05 +01:00
Vitaly Stakhovsky
82edd98300 cmSystemTools: MessageCallback and Message() accept std::string argument 2019-02-07 13:41:27 -05:00
Regina Pfeifer
bcee24aecc Use std::function for callbacks 2019-01-29 16:32:52 +01:00
Regina Pfeifer
5a0784ddea clang-tidy: Pass by value 2019-01-22 13:03:04 -05:00