This is an archive of the discontinued LLVM Phabricator instance.

Move EH spec mismatches under -fms-compatibility
ClosedPublic

Authored by rnk on Aug 26 2019, 3:45 PM.

Details

Summary

-fms-extensions is intended to enable conforming language extensions and
-fms-compatibility is intended to language rule relaxations, so a user
could plausibly compile with -fno-ms-compatibility on Windows while
still using dllexport, for example. This exception specification
validation behavior has been handled as a warning since before
-fms-compatibility was added in 2011. I think it's just an oversight
that it hasn't been moved yet.

This will help users find conformance issues in their code such as those
found in _com_ptr_t as described in https://llvm.org/PR42842.

Event Timeline

rnk created this revision.Aug 26 2019, 3:45 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 26 2019, 3:45 PM

This will definitely help us clean up our code, since we run the MSVC STL test suite with -fno-ms-compatibility -fno-delayed-template-parsing.

Other possible occurrences of ms-extensions that should be considered ms-compatibility:

  • ParseDeclCXX.cpp says "MSVC permits pure specifier on inline functions defined at class scope." which sounds like a rule relaxation.
  • Parser.cpp says "MS compatibility: MSVC permits using known types with typename. e.g. "typedef typename T* pointer_type"" while downgrading an error to a warning. Seems like this should be ms-compatibility.
  • SemaCast.cpp says "C++ 5.2.10p4: A pointer can be explicitly converted to any integral type large enough to hold it; except in Microsoft mode, where the integral type size doesn't matter (except we don't allow bool)." This definitely seems like ms-compatibility.
  • ParseExprCXX.cpp says "We have something like t::getAs<T>, where getAs is a member of an unknown specialization. However, this will only parse correctly as a template, so suggest the keyword 'template' before 'getAs' and treat this as a dependent template name." while downgrading an error to a warning.

I might regret asking about some of these, if Clang begins erroring on WinSDK etc. code that can't be rapidly updated.

hans accepted this revision.Aug 27 2019, 3:05 AM

lgtm

This revision is now accepted and ready to land.Aug 27 2019, 3:05 AM
This revision was automatically updated to reflect the committed changes.