--
You received this message because you are subscribed to the Google Groups "cxx" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cxx+uns...@chromium.org.
To post to this group, send email to c...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/cxx/CAAHOzFCS%2BnNKcAvyN0gcjvgy0iHn1mB2M6FiMgoFtfGf%3D%3DYUAA%40mail.gmail.com.
clang allows C99 features in C++ mode as an extension. We could pass -Wc99-extensions to flag those as warnings and not accept them, but it seems fine to me to allow them if people think they're useful. (If others disagree, I don't feel super strongly though.)
On Thu, Jun 21, 2018 at 4:11 PM Nico Weber <tha...@chromium.org> wrote:clang allows C99 features in C++ mode as an extension. We could pass -Wc99-extensions to flag those as warnings and not accept them, but it seems fine to me to allow them if people think they're useful. (If others disagree, I don't feel super strongly though.)Does that warn only for things that are "valid C99 but not valid C++"?
You can try sending a tryjob with it set and checking what it finds :-) (disable warnings as errors to see more than just the first TU.)
(resurrecting an old thread)It looks like we never came up with a decision on this? There's at least 30 places where designated initializers are being used in the codebase (https://cs.chromium.org/search/?q=%5C%7B%5Cs*%5C.%5Cw%2B%5Cs*%3D+-f:third_party&sq=package:chromium&type=cs) and I'm guilty for a few of those . If you think that these should be removed then I can remove my use cases and open a crbug to get the other one removed (IMO it's probably not worth the trouble but I'm not an expert on this topic :) ).
+1 to that.-wc99-extensions warns on a few other features that we do use in Chrome. It wasn't possible to just single out designated initializers.I didn't have the bandwidth to add this support to clang and to fix up Chrome, so I let things stand as we waited for MSVC to catch up.
--PK
You received this message because you are subscribed to the Google Groups "cxx" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cxx+uns...@chromium.org.
To post to this group, send email to c...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/cxx/CAAHOzFAEZHeLtyEgAo9OHLE8e7rUS3qB839U4dh7-VoLYP%2BbQw%40mail.gmail.com.
The internal style guide now allows designated initializers ( go/cstyle#Designated_initializers), they are using the "-Wreorder-init-list" flag to prevent potentially bad use cases.Should we reconsider supporting this feature or should we wait for the public style guide to be updated?
On Thu, Dec 12, 2019 at 10:12 AM Sébastien Marchand <sebma...@chromium.org> wrote:The internal style guide now allows designated initializers ( go/cstyle#Designated_initializers), they are using the "-Wreorder-init-list" flag to prevent potentially bad use cases.Should we reconsider supporting this feature or should we wait for the public style guide to be updated?Do these even compile with --std=c++14 and the other flags we pass? That is, is the extension to support these on by default?
(Personally, I'd prefer to wait until Chromium is actually C++20 to support these; I'm uncomfortable using nonstandard extensions unless we have to.)PK
On Thu, Dec 12, 2019 at 1:54 PM Peter Kasting <pkas...@google.com> wrote:On Thu, Dec 12, 2019 at 10:12 AM Sébastien Marchand <sebma...@chromium.org> wrote:The internal style guide now allows designated initializers ( go/cstyle#Designated_initializers), they are using the "-Wreorder-init-list" flag to prevent potentially bad use cases.Should we reconsider supporting this feature or should we wait for the public style guide to be updated?Do these even compile with --std=c++14 and the other flags we pass? That is, is the extension to support these on by default?I don't know, using designated initializers in //src seems to work fine but I don't see the "--std=c++14" flag on the compile command line...
--PK
You received this message because you are subscribed to the Google Groups "cxx" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cxx+uns...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/cxx/CAAHOzFB7ULn781-oTOzAGPJzKFHAL%2By%2BOFPLBoprvigDgSHAHA%40mail.gmail.com.
While MSVC did have some C99 support, it didn't support the designated initializers. Chrome didn't start getting them until the full switch to clang. (I used to do a parallel MSVC build, finding these new uses).On Thu, Dec 12, 2019 at 12:59 PM Scott Graham <sco...@chromium.org> wrote:On Thu, Dec 12, 2019 at 12:47 PM 'Peter Kasting' via cxx <c...@chromium.org> wrote:On Thu, Dec 12, 2019 at 11:37 AM Sébastien Marchand <sebma...@chromium.org> wrote:On Thu, Dec 12, 2019 at 1:54 PM Peter Kasting <pkas...@google.com> wrote:On Thu, Dec 12, 2019 at 10:12 AM Sébastien Marchand <sebma...@chromium.org> wrote:The internal style guide now allows designated initializers ( go/cstyle#Designated_initializers), they are using the "-Wreorder-init-list" flag to prevent potentially bad use cases.Should we reconsider supporting this feature or should we wait for the public style guide to be updated?Do these even compile with --std=c++14 and the other flags we pass? That is, is the extension to support these on by default?I don't know, using designated initializers in //src seems to work fine but I don't see the "--std=c++14" flag on the compile command line...From chatting with Rob earlier it sounds like we support these right now due to compiling with C99 extensions enabled, which means not only are there some in our codebase already, but people may add ones that violate the C++20 rules.MSVC never supported C99, so any uses here must have been added since we went clang-only. My preference would be to try and remove any use of C99 extensions, disable C99 extensions in our build globally, and then wait for C++20. But maybe that isn't the right cost/benefit decision.
MSVC >= 2015 supported the majority of C99 (including designated initializers) so I don't think there's any problem in practice.--PK
You received this message because you are subscribed to the Google Groups "cxx" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cxx+uns...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/cxx/CAAHOzFB7ULn781-oTOzAGPJzKFHAL%2By%2BOFPLBoprvigDgSHAHA%40mail.gmail.com.