[cfe-commits] [PATCH] Validate C99 and C++03's set of UCNs

Richard Smith richard at metafoo.co.uk
Fri Jan 25 16:41:37 PST 2013


On Fri, Jan 25, 2013 at 4:28 PM, Jordan Rose <jordan_rose at apple.com> wrote:
>
>
> ================
> Comment at: lib/Lex/UnicodeCharSets.h:80-85
> @@ +79,8 @@
> +
> +///// Returns true if the Unicode code point \p C is within the set of
> +///// characters specified by \p CharSet.
> +//template <size_t N>
> +//static inline bool isCharInSet(uint32_t C, const UnicodeCharRange (&Ranges)[N]){
> +//  return isCharInSet(C, llvm::makeArrayRef(Ranges));
> +//}
> +
> ----------------
> Oops. This will not appear in the final patch.
>
> ================
> Comment at: lib/Lex/Lexer.cpp:2797-2803
> @@ +2796,9 @@
> +        DiagnosticsEngine &Diags = PP->getDiagnostics();
> +        DiagnosticsEngine::Level CompatLevel =
> +          Diags.getDiagnosticLevel(diag::warn_cxx11_ucn_escape_surrogate,
> +                                   getSourceLocation());
> +        if (CompatLevel > DiagnosticsEngine::Ignored)
> +          Diag(BufferPtr, diag::warn_cxx11_ucn_escape_surrogate);
> +        else
> +          Diag(BufferPtr, diag::warn_ucn_escape_surrogate);
> +      }
> ----------------
> Richard Smith wrote:
>> This is a bit weird. What if warn_ucn_escape_surrogate is an error but warn_cxx11_ucn_escape_surrogate is just a warning? Perhaps have just one warning, but put it in both CXX11Compat and Unicode groups?
> I'm still wondering what the best thing to do here is. I was worried about "-Wunicode -Wno-c++11-compat" vs "-Wno-c++11-compat -Wunicode".

If we only want to keep one of these flags, I'd prefer we chose
-Wunicode. -Wc++11-compat already misses a whole bunch of things, and
I think we'd still want this warning enabled even in the case of
-Wno-c++11-compat.



More information about the cfe-commits mailing list