[PATCH] D121328: Disable -Wmissing-prototypes for internal linkage functions that aren't explicitly marked "static"""

David Blaikie via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 21 14:21:37 PDT 2022


dblaikie added a comment.

In D121328#3396984 <https://reviews.llvm.org/D121328#3396984>, @aaron.ballman wrote:

>> once we figure out what to do about the change in behavior for -Wnon-c-typedef-for-linkage
>
> The devil is in the details; I'm not sure what to do here. I don't think there's a way to compute the visibility without also computing the linkage, so I don't think there's a way to get the old behavior in the Chrome OS case as well as suppressing the diagnostic in the case you want to cover. I'm sympathetic to the issue, but this may be a case where it's a matter of picking which behavior is more important because we may not be able to have both (at least, not without work to tease apart linkage and visibility if that's possible).

Ah, fair. To /me/ it doesn't feel like `typedef struct { void f() { } } x;` is something we /really/ need to support, but clearly some code does use this, but it should be relatively cheap/simple to migrate away from that idiom and make the code more C++ idiomatic/simpler. But maybe there's some huge legacy of code using this idiom, such that breaking it would be costly. Don't really know.

@rsmith maybe you've got an idea of whether this (C-style typedef/name-for-linkage purposes with structs with member functions) is worth supporting?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D121328/new/

https://reviews.llvm.org/D121328



More information about the cfe-commits mailing list