summaryrefslogtreecommitdiffstats
path: root/src/network/ssl
Commit message (Collapse)AuthorAgeFilesLines
* Doc: Fix broken "see also" linksDavid Boddie9 days1-1/+1
| | | | | | Pick-to: 6.9 6.10 Change-Id: Idbfb39bbe1f16de420711911df0a8c47a2a75420 Reviewed-by: Mårten Nordheim <[email protected]>
* network/ssl: Fix deprecated usages of QHashCombineIvan Solovev2025-05-262-2/+2
| | | | | | | | Amends c05ae82efb33507959ae2082483fb9425ccca8a0 which deprecated the default constructor in favor of always requiring to pass the seed. Change-Id: I1d77aff13fd1af8b8db8c61b19a6f70cfd092f54 Reviewed-by: Edward Welbourne <[email protected]>
* QSslCertificate: add fromFile() methodAhmad Samir2025-05-142-15/+32
| | | | | | | | | | | | | | | | | | | | QSslCertificate::fromPath() does some extra work: - matching wildcard glob or regular expression patterns - checks if the string it's called on is a file or a dir That extra work isn't needed when you already have the path to a specific certificate file. E.g. qtlsbackend_openssl.cpp:systemCaCertificates() used to call fromPath() on *.pem/*.crt files that it got from iterating over system certifcates dirs. This also de-duplicates the code in fromPath(). [ChangeLog][QtNetwork][QSslCertificate] Added fromFile() method. Change-Id: I92ab358e4711866dd4510da42c47905c7dae58b1 Reviewed-by: Ivan Solovev <[email protected]> Reviewed-by: Mårten Nordheim <[email protected]>
* QSslCertificate: fromPath(): check the path arg isn't emptyAhmad Samir2025-05-141-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | `path` may contain wildcard glob patterns or regular expression ones, so this method tries to get a path prefix without those special characters, but that prefix could end up being empty, to counter that, "." is used as a prefix. This led to iterating over the current dir, which isn't the intended behavior. If the current dir has many files, this could end up slowing things down (which is what happens in the bug report). Fix the issue by returning early if `path` is empty. Amends 49f143e19ca11ef48260a3aaaa4ddbe490cf81ab. [ChangeLog][QtNetwork][QSslCertificate][Important Behavior Changes] fromPath() no longer accepts an empty path, which would previously result in searching the current directory. Fixes: QTBUG-134419 Pick-to: 6.9 6.8 6.5 Change-Id: I29224c3a47794b4095db5feae32a964dd9b854ff Reviewed-by: Mårten Nordheim <[email protected]> Reviewed-by: Timur Pocheptsov <[email protected]>
* QSslCertificate: fix PatternSyntax enum valueAhmad Samir2025-05-141-1/+1
| | | | | | | | | | | | | Regexp was renamed to RegularExpression. Amends 813111689629a71e51d7d149a5f689b2961f2716. This looks like a "dead" code path, QT_FEATURE_regularexpression is most likely always enabled. Pick-to: 6.9 6.8 6.5 5.15 Change-Id: I99af481bb41a197a0b7d00c750440a93d8e6a3fe Reviewed-by: Ivan Solovev <[email protected]>
* QCryptographicHash: remove QT_CRYPTOGRAPHICHASH_ONLY_SHA1Ahmad Samir2025-04-021-2/+0
| | | | | | | | | | | | It was added in 44cb71d6fdb0b7285d4ef74a1ef778323aa9e5ee to reduce the size of the bootstrap lib. Since commit c7f64d84fbd9b5b3cac41c1d81dc4d0479fc3fa1 removed QCryptographicHash from the bootstrap lib, the macro is now redundant (unless it's used by QtLite). Change-Id: I5459a52507bc9e0a7b982b4382211be9a23c4ad9 Reviewed-by: Thiago Macieira <[email protected]>
* Docs: fix qdoc enum's \value "since" syntaxAhmad Samir2025-01-211-2/+2
| | | | | | | | | Square brackets. https://doc.qt.io/qt-6/10-qdoc-commands-tablesandlists.html#value Pick-to: 6.9 Change-Id: I1d9237461a4eafb72b28ae019c02ba72f82d0f17 Reviewed-by: Thiago Macieira <[email protected]>
* Replace qdebug.h includes in public headers with forward-declarationsAhmad Samir2025-01-151-0/+1
| | | | | | | | | | | | | | | | | | | qdebug.h includes many Qt and STL headers, so if you include a Qt header you get all those transitive includes, which may affect build time. - Where appropriate use the printf-like syntax of qDebug() and co., these don't need the QDebug streaming operators - qfloat16 is used in an inline member function, so include it explicitly [ChangeLog][Potentially Source Incompatible Changes] Various Qt public headers don't include QDebug any more; if you need QDebug's streaming you'll have to include it in your code. Task-number: QTBUG-132439 Pick-to: 6.9 Change-Id: I750587e17a3b38fa226cd3af8eaccc8da580f436 Reviewed-by: Thiago Macieira <[email protected]>
* Create qdoc macros for C++ class docs 2.1: qHash()Marc Mutz2024-11-275-16/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | Add a family of qdoc macros to document the various qHash() overloads we have. This patch does not change the \relates of the qHash() functions, they remain as inconsistent as they have been. Created QTBUG-129815 to clean things up. Since this author expects the \relates to change in the future, there are different \qhash commands, and all except \qhashbuiltin take the class name as an argument, for use in a centrally-choreographed fix for QTBUG-129815. As drive-by's, fix: - missing documentation about Key having to support qHash() in the associative Qt containers - drop noexcept and default arguments from \fn lines that needed to have their argument names changed - move the QStringView overload from qhash.cpp to qstringview.cpp (as it \relates to the former) Fixes: QTBUG-129574 Pick-to: 6.8 6.5 Change-Id: I8e8c2edc27422cbe5823f56baf3a24d7f7050836 Reviewed-by: Ivan Solovev <[email protected]> Reviewed-by: Jaishree Vyas <[email protected]>
* Create qdoc macros for C++ class docs 1.3: member-swap(), non-standard phrasingMarc Mutz2024-11-081-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | We have some patterns for how to document certain functions, but we also vary the sentences a lot, and you have to look up one documentation piece and copy it, essentially. If we ever want to change them, we end up with shotgun surgery. So apply DRY to the documentation and start a collection of macros to help with repetitive C++ class documentation tasks. The first macro is for member-swap(), and this third patch is for documentation that used a non-standard phrasing for documenting member-swap(). By using the macro, the documentation automatically conforms to what the documentation team picks as the \memberswap expansion going forward. As a drive-by, fix doc block indentation to the Qt standard of 4 spaces (only in changed lines), and add a few blank lines where they were missing before. Fixes: QTBUG-129573 Pick-to: 6.8 6.7 6.5 6.2 Change-Id: If007602d7690572fcbb848a8d0235416c908cfd2 Reviewed-by: Topi Reiniö <[email protected]> Reviewed-by: Ivan Solovev <[email protected]>
* Create qdoc macros for C++ class docs 1.2: member-swap(), simplified phrasingMarc Mutz2024-11-088-23/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We have some patterns for how to document certain functions, but we also vary the sentences a lot, and you have to look up one documentation piece and copy it, essentially. If we ever want to change them, we end up with shotgun surgery. So apply DRY to the documentation and start a collection of macros to help with repetitive C++ class documentation tasks. The first macro is for member-swap(), and this second patch is for documentation that used the simplified phrasing ("Swaps this X with \a other."), which this patch adopts as the text for \memberswap, too, because it doesn't repeat the macro argument, making it easier to find a grammatically-fitting argument than in the traditional phrasing. This doesn't change the documentation, except as follows: * standardizes on simpified instead of traditional phrasing for docs that already use the \memberswap macro * adds the "very fast and never fails" blurb, if it was missing * changes the function's argument name to `other`, as required by the macro. Task-number: QTBUG-129573 Pick-to: 6.8 6.7 6.5 6.2 Change-Id: I1123e783ce0da76c5997ff74007d77504ac5b334 Reviewed-by: Topi Reiniö <[email protected]> Reviewed-by: Ivan Solovev <[email protected]>
* Network: don't include qglobal.hMårten Nordheim2024-10-132-3/+0
| | | | | | | Task-number: QTBUG-106722 Fixes: QTBUG-106728 Change-Id: Id0435ad2ffffdb159e44c1929df6ba904bd5b01a Reviewed-by: Volker Hilsheimer <[email protected]>
* Pass QSslError::SslError by valueMate Barany2024-08-302-2/+14
| | | | | | | | | | | | | | | | | | | | It is a small and trivially copyable type. As a drive-by, make the operator a hidden friend. Found by an Axivion scan. [ChangeLog][Potentially Source-Incompatible Changes][QtNetwork] Made the QSslError::SslError QDebug operator<< a hidden friend of QSslError. This means the operator is no longer a match for arguments implicitly converting to SslError, only for SslError itself. A backwards-compatible fix is to make the conversion explicit: debug << QSslError::SslError(arg). Task-number: QTBUG-125026 Pick-to: 6.8 Change-Id: I9b6673397b6a26d508783304240c91fa058139bc Reviewed-by: Marc Mutz <[email protected]> Reviewed-by: Ivan Solovev <[email protected]>
* Change type of variable qssl_dhparams_default_base64Mate Barany2024-07-311-1/+1
| | | | | | | | | | From const char* to const char[] to address a "Character pointer is not const" Axivion warning. Task-number: QTBUG-125026 Pick-to: 6.8 6.7 6.5 Change-Id: I0d6606c6abde5b01ec250ffb4595c89a497b7c29 Reviewed-by: Marc Mutz <[email protected]>
* Initialize error in QSslErrorPrivateMate Barany2024-07-311-4/+1
| | | | | | | | | | | | | | | Axivion warning: "Compiler-generated constructor leaves some fields uninitialized." As the constructor of QSslError sets the error to QSslError::NoError do the same in QSslErrorPrivate with NSDMI. Task-number: QTBUG-125026 Pick-to: 6.8 6.7 6.5 Change-Id: I0db85dffb5eda3a6c768e326f87a01f8c176e4f1 Reviewed-by: Timur Pocheptsov <[email protected]> Reviewed-by: Marc Mutz <[email protected]> Reviewed-by: Mårten Nordheim <[email protected]>
* Include qnetworkglobal_p.h into qocsp_p.hMate Barany2024-07-231-0/+2
| | | | | | | | | | Addressing a "Q_OS_WIN should not be checked before qglobal.h is included" Axivion warning. Task-number: QTBUG-125026 Pick-to: 6.8 6.7 6.5 Change-Id: I78c3df04a92aab8753c2651502d7893822523ed0 Reviewed-by: Marc Mutz <[email protected]>
* Add move constructor to QSslCertificateMate Barany2024-07-122-0/+17
| | | | | | | | | | | | The class has a move assignment operator, it should have a move constructor as well. Found by an Axivion scan. Task-number: QTBUG-125026 Pick-to: 6.8 Change-Id: I71fe066a84baede3a8cd309977a4a73d849dcfd1 Reviewed-by: Marc Mutz <[email protected]>
* QDirListing: add flags to handle entries filteringAhmad Samir2024-06-271-2/+2
| | | | | | | | | | | | | | | | | | By extending IteratorFlag so that it replaces both QDir::Filter and QDirIterator::IteratorFlag enums, but with better defaults (based on how QDir/Iterator is used in 15-20 years worth of code in Qt and KDE). Make the QDirListing(QDir ~~) ctor private, also change it to use QDirIterator::IteratatorFlags; it will be used to port existing code. If QDir is ported to use QDirListing::IteratorFlags, instead of QDir::Filters, a public QDirListing(QDir) constructor can then be added. Pick-to: 6.8 Fixes: QTBUG-125504 Task-number: QTBUG-125859 Change-Id: Ide4ff8279f554029ac30d0579b0e8373ed4337f7 Reviewed-by: Thiago Macieira <[email protected]>
* Disable copy and move operations in TlsKeyMate Barany2024-06-271-0/+3
| | | | | | | | | | | | | TlsKeyOpenSSL has a custom constructor but no other special member functions. Instead of disabling them in TlsKeyOpenSSL, disable them in the base class. Amends 1a0da3ae69964142b3a31d87ecc88a925006a4de. Pick-to: 6.8 6.7 6.5 6.2 Task-number: QTBUG-125026 Change-Id: I54f3ac01f89a21b8665c4d82a8f38dedab9bb5c3 Reviewed-by: Marc Mutz <[email protected]>
* QSslConfiguration: add documentation for HTTP/2 alpn variableMårten Nordheim2024-04-171-0/+6
| | | | | | | | | It was missing for a long time Pick-to: 6.7 6.5 Change-Id: I209838a3c7b45c8c2e8da21efea306fafddea891 Reviewed-by: Edward Welbourne <[email protected]> Reviewed-by: Mate Barany <[email protected]>
* Network: Add Q_GADGET to types exposed in signals and slotsUlf Hermann2024-04-171-0/+1
| | | | | | | | | | | In order to build a complete graph of metaobjects via properties and methods we need to know about all argument and return types as metaobjecs. Such a graph is desirable for reasoning about the consistency of the type system. Task-number: QTBUG-101143 Change-Id: Ic4e2f58a4275df06178437c6d45270f3f2aa5ce6 Reviewed-by: Fabian Kosmale <[email protected]>
* Clarify the priority in selecting TLS backendsTimur Pocheptsov2024-03-221-1/+6
| | | | | | | | | | | In case a custom TLS plugin is provided, the order can be unclear (next after OpenSSL is either Schannel on Windows, or Secure Transport on Darwin, then a custom plugin, if any, and the last one is 'cert-only'). Pick-to: 6.7 6.6 6.5 6.2 Fixes: QTBUG-123092 Change-Id: I02bcc1fa5448f64846d561a72b2522af3286c66c Reviewed-by: Mårten Nordheim <[email protected]>
* Port to QDirListingAhmad Samir2024-03-031-4/+7
| | | | | | | | | | | Use QDirListing in the Bootstrap build instead of QDirIterator. Drive-by changes: - more const variables - use emplace_back() instead of append() where appropriate Change-Id: Ie1f0d03856e557c4bfabfff38a87edc7da86d091 Reviewed-by: Thiago Macieira <[email protected]>
* Network: includemocsMårten Nordheim2024-02-231-0/+2
| | | | | Change-Id: I81defa535dcbe81ddcf9be6ff2258cde909861a3 Reviewed-by: Edward Welbourne <[email protected]>
* QSsl: QMetaObject is defined in qobjectdefs.hMarc Mutz2024-01-231-1/+1
| | | | | | | | | | | | | | | | | ... not in qmetaobject.h. Don't include more than we need. Found in API-Review. Amends b856790d67ad25f5cd8e374cb299a129acbea2ff. [ChangeLog][QtNetwork] The enums in namespace QSsl are now Q_ENUMs. Pick-to: 6.7 Change-Id: I67ec107ce5ab266cfad8a628e7ba3496d2484766 Reviewed-by: Tatiana Borisova <[email protected]> Reviewed-by: Mårten Nordheim <[email protected]>
* Fix accidental implicit QBA->QString conversionMårten Nordheim2024-01-181-4/+3
| | | | | | | | | | And make sure it cannot happen again by adding the QT_NO_CAST_FROM_ASCII define to the Network module. Amends 5346404da64ac87d161f510d9fee71899d7c70ba Change-Id: Ib10d7822c514caaf40b6b36ee71947c034daf338 Reviewed-by: Ivan Solovev <[email protected]>
* Fix missing certs directory in VxWorksMarcin Zdunek2024-01-161-1/+14
| | | | | | | | | | tst_qsslsocket checks for system CA certificates, which VxWorks doesn't have out of the box, which causes a lot of testcases to fail. As VxWorks doesn't provide default directory structure, directory with ssl certs is provided by setting a variable. Task-number: QTBUG-115777 Change-Id: I5c93933ee5fbcafd6ffd76b574d8793fe75dbdbc Reviewed-by: Mårten Nordheim <[email protected]>
* Remove the use of Q_NETWORK_PRIVATE_EXPORTAlexey Edelev2023-12-222-7/+7
| | | | | | | Task-number: QTBUG-117983 Change-Id: I2339dc96b49aba38169ad3e84f48c9d3c97d6117 Reviewed-by: Qt CI Bot <[email protected]> Reviewed-by: Mårten Nordheim <[email protected]>
* QSslConfiguration: remove exampleTimur Pocheptsov2023-12-051-4/+1
| | | | | | | | | | | | It uses the ciphersuite name which smart tools one day will mark as weak (i.e. https://ciphersuite.info/cs/TLS_DHE_DSS_WITH_AES_256_CBC_SHA/ in our example), names in the example are not in the standard notation, + it is and always was OpenSSL-specific example. Pick-to: 6.6 6.5 6.2 Fixes: QTBUG-119464 Change-Id: Ic6f095ff2c861582de756bf220e2e74106b88e83 Reviewed-by: Mårten Nordheim <[email protected]>
* Use SSL_CTX_set_dh_auto if DHparam is emptyAndré Klitzing2023-10-251-0/+3
| | | | | | | | | | [ChangeLog][QtNetwork][QSslDiffieHellmanParameters] An empty Diffie-Hellmann parameter enables auto selection of openssl backend. Fixes: QTBUG-117666 Change-Id: Ic2e0529d48542752ca801bcb4d609988e5ddff25 Reviewed-by: Mårten Nordheim <[email protected]>
* Doc: Don't mention setDefaultCiphers() (removed in Qt 6.0)Kai Köhne2023-09-281-2/+1
| | | | | | Pick-to: 6.5 6.6 Change-Id: I775da7679bf4ff398a22334103c3116befec7da9 Reviewed-by: Timur Pocheptsov <[email protected]>
* Add Q_ENUM macros for registering QSsl/QSslSocket in Meta-systemTatiana Borisova2023-09-212-0/+15
| | | | | | | | | - Macros provide possibility to use enums in QML via QtNetwork QML module Task-number: QTBUG-115056 Change-Id: I1ed96a7eb4b12681d16137528307fec6db5b016c Reviewed-by: Qt CI Bot <[email protected]> Reviewed-by: Ulf Hermann <[email protected]>
* qsslcertificate: use _ba literal moreAnton Kudryavtsev2023-09-071-11/+10
| | | | | | | to reduce allocations Change-Id: I10a449887b79e40fb4e501634f64b9c86cc8f111 Reviewed-by: Mårten Nordheim <[email protected]>
* qsslcertificate: use QStringView moreAnton Kudryavtsev2023-09-071-4/+6
| | | | | | | to avoid needless allocations Change-Id: I54d159cbaa0854355286c942a6971e45c4494a14 Reviewed-by: Mårten Nordheim <[email protected]>
* qsslcertificate: use QAnyStringView moreAnton Kudryavtsev2023-09-071-1/+1
| | | | | | | to avoid needless allocations Change-Id: I03494d7075e2f333cbd3974797d9ea97f2c915fd Reviewed-by: Mårten Nordheim <[email protected]>
* qsslcertificate: avoid implicit detachAnton Kudryavtsev2023-09-071-7/+7
| | | | | | | by using const methods Change-Id: I62bf869ed1fd4109c855caafa88b8f29a6e5cc05 Reviewed-by: Mårten Nordheim <[email protected]>
* QSslServer: include mocMårten Nordheim2023-07-071-0/+2
| | | | | | Pick-to: 6.6 6.5 Change-Id: I7849a47b50930640f1937ba34976d2465390daf9 Reviewed-by: Marc Mutz <[email protected]>
* QtNetwork: code tidies: use the 4-arg connect overloadGiuseppe D'Angelo2023-07-051-1/+1
| | | | | | | | | | The 3-arg connect is error-prone and makes the lifetime of the connection unclear. Amends dae24df07fb3db37939e9ece4cf94f223a125f16 Change-Id: Iec1c2cb266fcaca1a1c407a6158cc8bbb282756b Reviewed-by: Mårten Nordheim <[email protected]>
* SSL: upgrade the default DH parametersGiuseppe D'Angelo2023-06-272-8/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We have been using as default DH parameters the 1024-bit MODP group. This is now considered insecure, and applications should use the 2048-bit at a minimum [1]. This commit therefore replaces the parameters with the 2048-bit MODP group from [2]. To double check the data, use openssl asn1parse to verify that the prime matches. For instance: 1) put the encoded string in a `encoded.txt` file (c&p from the source, removing the double quotes) 2) put the hexadecimal value of the 2048-bit group in a `reference.txt` file (c&p from [2]) 3) compare the output of openssl asn1parse with the reference. For instance like this: $ diff <(openssl asn1parse < encoded.txt | grep -m 1 INTEGER | perl -pe 's/.*://; s/\n//') <(perl -0777 -pe 's/\s//g' reference.txt) && echo OK OK [1] https://datatracker.ietf.org/doc/html/rfc8247#section-2.4 [2] https://datatracker.ietf.org/doc/html/rfc3526#section-3 [ChangeLog][QtNetwork][QSslDiffieHellmanParameters] The default Diffie-Hellman parameters are now using the 2048-bit MODP group from RFC 3526. Pick-to: 6.6 6.5 6.2 5.15 Change-Id: I47133cd78ba0e954b8f93a3da09fa2c760c9f7a8 Reviewed-by: Timur Pocheptsov <[email protected]>
* QtNetwork: code tidies: use the 4-arg connect overloadGiuseppe D'Angelo2023-06-261-2/+3
| | | | | | | | The 3-arg connect is error-prone and makes the lifetime of the connection unclear. Change-Id: I43dabe3d25ffc2b711aa50dec525d72a8810861c Reviewed-by: Mårten Nordheim <[email protected]>
* Schannel: Add support for proper listing of ciphersTobias Koenig2023-06-163-14/+22
| | | | | | | | | | | | | | Reworked the code to list supported ciphers for Schannel backend to provide the proper cipher names and cipher properties. Note: restricting the used ciphers for a TLS connection is only supported for TLS 1.2 yet! [ChangeLog][QtNetwork][QSslConfiguration] Add support for listing supported ciphers with Schannel backend. Change-Id: Idfc17335ec489315387a3e84b7a76a263be22378 Reviewed-by: Mårten Nordheim <[email protected]>
* Ssl: Copy the on-demand cert loading bool from default configMårten Nordheim2023-05-291-0/+5
| | | | | | | | | | | | | | | | | | Otherwise individual sockets will still load system certificates when a chain doesn't match against the configured CA certificates. That's not intended behavior, since specifically setting the CA certificates means you don't want the system certificates to be used. Follow-up to/amends ada2c573c1a25f8d96577734968fe317ddfa292a This is potentially a breaking change because now, if you ever add a CA to the default config, it will disable loading system certificates on demand for all sockets. And the only way to re-enable it is to create a null-QSslConfiguration and set it as the new default. Pick-to: 6.5 6.2 5.15 Change-Id: Ic3b2ab125c0cdd58ad654af1cb36173960ce2d1e Reviewed-by: Timur Pocheptsov <[email protected]>
* QSslCertificate: Add property names to debug operator<<Axel Spoerl2023-04-041-8/+8
| | | | | | | | | | | | When qDebugging a QSslCertificate, its properties are printed without property names. That makes it difficult to identify which output string correlates to which data element. This patch adds the property name to each output field. Pick-to: 6.5 Change-Id: Icdc54520e048f5fa03e8d9ed0ab2a42371e5a00d Reviewed-by: Timur Pocheptsov <[email protected]>
* QPasswordDigestor: add OpenSSL 3.0 support to deriveKeyPbkdf2Jan Grulich2023-02-091-2/+96
| | | | | | | | | | | Use OpenSSL 3.0 in deriveKeyPbkdf2() if it's available. This currently produces same results, but in the future we will have possibilities to force some additional compliancy, for example we can enable SP800-132 compliance checks, which are not enabled currently because it would differ from the original implementation. Change-Id: Ia7a7cc91ea3f20c9d76e39309daa7c97cd7ad5c6 Reviewed-by: Mårten Nordheim <[email protected]>
* Remove redundant qsharedpointer.h #includesAhmad Samir2023-01-313-3/+2
| | | | | | | In some cases added #include <QtCore/qshareddata.h>. Change-Id: Idc84c4ad6b0bd58e1a67af335dfcff67fdf80b2a Reviewed-by: Thiago Macieira <[email protected]>
* QtNetwork: Disambiguate static variablesFriedemann Kleint2023-01-311-4/+4
| | | | | | | | | They causes clashes in CMake Unity (Jumbo) builds. Pick-to: 6.5 Task-number: QTBUG-109394 Change-Id: Ifd0539c3b56dc395a860de927736f60ad766224a Reviewed-by: Mårten Nordheim <[email protected]>
* Replace usages of Q_CLANG_QDOC with Q_QDOCLuca Di Sera2022-10-214-4/+4
| | | | | | | | | | | | | | | | | | | | | | | To allow the user to customize the C++ code that QDoc sees, so as to be able to work-around some limitations on QDoc itself, QDoc defines two symbols: Q_QDOC and Q_CLANG_QDOC, both of which are "true" during an entire execution of QDoc. At a certain point in time, QDoc allowed the user the choice between a custom C++ parser and a Clang based one. The Q_QDOC symbol would always be defined while the Q_CLANG_QDOC symbol would be defined only when the Clang based parser was chosen. In more recent times, QDoc always uses a Clang based parser, such that both Q_CLANG_QDOC and Q_QDOC are always defined, making them equivalent. To avoid using different symbols, and the possible confusion and fragmentation that derives from it, all usages of Q_CLANG_QDOC are now replaced by the equivalent usages of Q_QDOC. Change-Id: I5810abb9ad1016a4c5bbea99acd03381b8514b3f Reviewed-by: Kai Koehne <[email protected]>
* Fix duplicated words in documentationMårten Nordheim2022-10-191-1/+1
| | | | | | | | | | | Only did instances where two-and-two words are duplicated, easy to see when wrong. Task-number: QTBUG-107777 Pick-to: 6.4 Change-Id: I11593728acc386e7ef9aba9b39a0a4d9c60a532f Reviewed-by: Ievgenii Meshcheriakov <[email protected]> Reviewed-by: Edward Welbourne <[email protected]>
* QSslServer[docs]: fix grammarMårten Nordheim2022-10-191-1/+1
| | | | | | | | | s/a/an Fixes: QTBUG-107777 Pick-to: 6.4 Change-Id: I11159202304fc5f892ee41552d110f3a838470f9 Reviewed-by: Ievgenii Meshcheriakov <[email protected]>
* Long live Q_UNREACHABLE_RETURN()!Marc Mutz2022-10-152-6/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a combination of Q_UNREACHABLE() with a return statement. ATM, the return statement is unconditionally included. If we notice that some compilers warn about return after __builtin_unreachable(), then we can map Q_UNREACHABLE_RETURN(...) to Q_UNREACHABLE() without having to touch all the code that uses explicit Q_UNREACHABLE() + return. The fact that Boost has BOOST_UNREACHABLE_RETURN() indicates that there are compilers that complain about a lack of return after Q_UNREACHABLE (we know that MSVC, ICC, and GHS are among them), as well as compilers that complained about a return being present (Coverity). Take this opportunity to properly adapt to Coverity, by leaving out the return statement on this compiler. Apply the macro around the code base, using a clang-tidy transformer rule: const std::string unr = "unr", val = "val", ret = "ret"; auto makeUnreachableReturn = cat("Q_UNREACHABLE_RETURN(", ifBound(val, cat(node(val)), cat("")), ")"); auto ignoringSwitchCases = [](auto stmt) { return anyOf(stmt, switchCase(subStmt(stmt))); }; makeRule( stmt(ignoringSwitchCases(stmt(isExpandedFromMacro("Q_UNREACHABLE")).bind(unr)), nextStmt(returnStmt(optionally(hasReturnValue(expr().bind(val)))).bind(ret))), {changeTo(node(unr), cat(makeUnreachableReturn, ";")), // TODO: why is the ; lost w/o this? changeTo(node(ret), cat(""))}, cat("use ", makeUnreachableReturn)) ); where nextStmt() is copied from some upstream clang-tidy check's private implementation and subStmt() is a private matcher that gives access to SwitchCase's SubStmt. A.k.a. qt-use-unreachable-return. There were some false positives, suppressed them with NOLINTNEXTLINE. They're not really false positiives, it's just that Clang sees the world in one way and if conditonal compilation (#if) differs for other compilers, Clang doesn't know better. This is an artifact of matching two consecutive statements. I haven't figured out how to remove the empty line left by the deletion of the return statement, if it, indeed, was on a separate line, so post-processed the patch to remove all the lines matching ^\+ *$ from the diff: git commit -am meep git reset --hard HEAD^ git diff HEAD..HEAD@{1} | sed '/^\+ *$/d' | recountdiff - | patch -p1 [ChangeLog][QtCore][QtAssert] Added Q_UNREACHABLE_RETURN() macro. Change-Id: I9782939f16091c964f25b7826e1c0dbd13a71305 Reviewed-by: Marc Mutz <[email protected]> Reviewed-by: Thiago Macieira <[email protected]>