summaryrefslogtreecommitdiffstats
path: root/src/corelib/io/qfile.h
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@qt.io>2023-06-21 21:15:31 +0200
committerMarc Mutz <marc.mutz@qt.io>2023-06-28 20:48:45 +0000
commit01e1dc273d0fd95e4e4f57ae0af1862196f72bd6 (patch)
tree21fd684505841f970169a5a4d2f5a45ef0536383 /src/corelib/io/qfile.h
parent574a47dd5a89e7cecf4fbf592dd0d5b216c3b0a6 (diff)
Remove all class-level [[nodiscard]] from the code-base
A class-level [[nodiscard]] used to be the only way to get a waring for code such as QMutexLocker(&mutex); with original C++17 means. This was because a few of our compilers would warn about the presence of [[nodiscard]] on ctors, which is really the semantics we want: we don't want to prevent users from passing QMutexLocker out of functions and users of those functions from ignoring the return value, if they so choose. That should be the choice of the author of the function returning such types, not ours. So QUIP-0019 makes class-level [[nodiscard]] conditional on proper rationale in the user docs (or the commit message in case of private API). Since none of the existing uses really strikes this author as particularly convincing, remove them all. All these classes have gotten Q_NODISCARD_CTOR on all their ctors, so we continue to provide the same true positive warnings, minus the false positives when returning from functions, at least on the majority of compilers (and it's not as if all compilers interpreted a class-level [[nodiscard]] as a trigger to warn on the initial example of this commit message). Task-number: QTBUG-104164 Pick-to: 6.6 Change-Id: I163356486e7c80f9d69bf67023010a88233fe662 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/io/qfile.h')
-rw-r--r--src/corelib/io/qfile.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/corelib/io/qfile.h b/src/corelib/io/qfile.h
index 1153ba7686..839a2b51fe 100644
--- a/src/corelib/io/qfile.h
+++ b/src/corelib/io/qfile.h
@@ -37,7 +37,7 @@ Q_CORE_EXPORT bool qEnableNtfsPermissionChecks() noexcept;
Q_CORE_EXPORT bool qDisableNtfsPermissionChecks() noexcept;
Q_CORE_EXPORT bool qAreNtfsPermissionChecksEnabled() noexcept;
-class [[nodiscard]] QNtfsPermissionCheckGuard
+class QNtfsPermissionCheckGuard
{
Q_DISABLE_COPY_MOVE(QNtfsPermissionCheckGuard)
public: