This is an archive of the discontinued LLVM Phabricator instance.

[ms] Parse #pragma optimize and ignore it behind its own flag
ClosedPublic

Authored by hans on Mar 19 2018, 8:33 AM.

Details

Summary

This allows users to turn off warnings about this pragma specifically, while still receiving warnings about other ignored pragmas.

Diff Detail

Repository
rL LLVM

Event Timeline

hans created this revision.Mar 19 2018, 8:33 AM
rnk accepted this revision.Mar 19 2018, 8:49 AM

lgtm, thanks!

lib/Parse/ParsePragma.cpp
2970 ↗(On Diff #138940)

One day, someone ought to refactor pragma parsing to be less verbose and error prone, but today is not that day.

This revision is now accepted and ready to land.Mar 19 2018, 8:49 AM
thakis accepted this revision.Mar 19 2018, 12:41 PM

Awesome, thanks! One nit below:

include/clang/Basic/DiagnosticParseKinds.td
973 ↗(On Diff #138940)

Is pragma clang optimize really what we want to recommend here? pragma optimize is used in practice mostly to work around cl.exe compiler bugs, or to disable inlining. In neither case, pragma clang optimize is what you'd really want to use. Maybe just omit everything after ; and instead add a blurb about this in DiagnosticDocs.td ?

hans marked an inline comment as done.Mar 20 2018, 1:55 AM
hans added inline comments.
include/clang/Basic/DiagnosticParseKinds.td
973 ↗(On Diff #138940)

I'll drop the suggestion for now.

Turns out it was not so easy to get a blurb into DiagnosticDocs or DiagnosticsReference. They're auto-generated but don't seem to have a good way to enter extra documentation. I'll just leave it for now.

This revision was automatically updated to reflect the committed changes.
hans marked an inline comment as done.