[all-commits] [llvm/llvm-project] e46468: [Clang] Allow raw string literals in C as an exten...

Sirraide via All-commits all-commits at lists.llvm.org
Wed Jul 10 03:11:05 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: e46468407a7bb7f8b2fe13675a5a1c32b85f8cad
      https://github.com/llvm/llvm-project/commit/e46468407a7bb7f8b2fe13675a5a1c32b85f8cad
  Author: Sirraide <aeternalmail at gmail.com>
  Date:   2024-07-10 (Wed, 10 Jul 2024)

  Changed paths:
    M clang/docs/ReleaseNotes.rst
    M clang/include/clang/Basic/DiagnosticDriverKinds.td
    M clang/include/clang/Basic/LangOptions.def
    M clang/include/clang/Basic/LangStandard.h
    M clang/include/clang/Driver/Options.td
    M clang/lib/Basic/LangOptions.cpp
    M clang/lib/Driver/ToolChains/Clang.cpp
    M clang/lib/Frontend/CompilerInvocation.cpp
    M clang/lib/Lex/DependencyDirectivesScanner.cpp
    M clang/lib/Lex/Lexer.cpp
    A clang/test/Driver/fraw-string-literals-cxx.cpp
    A clang/test/Lexer/raw-string-ext.c
    M clang/unittests/Lex/DependencyDirectivesScannerTest.cpp

  Log Message:
  -----------
  [Clang] Allow raw string literals in C as an extension (#88265)

This enables raw R"" string literals in C in some language modes
and adds an option to disable or enable them explicitly as an
extension.

Background: GCC supports raw string literals in C in `-gnuXY` modes
starting with gnu99. This pr both enables raw string literals in gnu99 
mode and later in C and adds an `-f[no-]raw-string-literals` flag to override 
this behaviour. The decision not to enable raw string literals in gnu89
mode, according to the GCC devs, is intentional as that mode is supposed
to be used for ‘old code’ that they don’t want to break; we’ve decided to
match GCC’s behaviour here as well.

The `-fraw-string-literals`  flag can additionally be used to enable raw string 
literals in modes where they aren’t enabled by default (such as c99—as 
opposed to gnu99—or even e.g. C++03); conversely, the negated flag can 
be used to disable them in any gnuXY modes that *do* provide them by 
default, or to override a previous flag. However, we do *not*  support 
disabling raw string literals (or indeed either of these two options) in 
C++11 mode and later, because we don’t want to just start supporting 
disabling features that are actually part of the language in the general case.

This fixes #85703.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list