Skip to content
Snippets Groups Projects
  • Jordan Rose's avatar
    693fdfa0
    Preprocessor: don't consider // to be a line comment in -E -std=c89 mode. · 693fdfa0
    Jordan Rose authored
    It's beneficial when compiling to treat // as the start of a line
    comment even in -std=c89 mode, since it's not valid C code (with a few
    rare exceptions) and is usually intended as such. We emit a pedantic
    warning and then continue on as if line comments were enabled.
    This has been our behavior for quite some time.
    
    However, people use the preprocessor for things besides C source files.
    In today's prompting example, the input contains (unquoted) URLs, which
    contain // but should still be preserved.
    
    This change instructs the lexer to treat // as a plain token if Clang is
    in C90 mode and generating preprocessed output rather than actually compiling.
    
    <rdar://problem/13338743>
    
    git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176526 91177308-0d34-0410-b5e6-96231b3b80d8
    693fdfa0
    History
    Preprocessor: don't consider // to be a line comment in -E -std=c89 mode.
    Jordan Rose authored
    It's beneficial when compiling to treat // as the start of a line
    comment even in -std=c89 mode, since it's not valid C code (with a few
    rare exceptions) and is usually intended as such. We emit a pedantic
    warning and then continue on as if line comments were enabled.
    This has been our behavior for quite some time.
    
    However, people use the preprocessor for things besides C source files.
    In today's prompting example, the input contains (unquoted) URLs, which
    contain // but should still be preserved.
    
    This change instructs the lexer to treat // as a plain token if Clang is
    in C90 mode and generating preprocessed output rather than actually compiling.
    
    <rdar://problem/13338743>
    
    git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176526 91177308-0d34-0410-b5e6-96231b3b80d8
Code owners
Assign users and groups as approvers for specific file changes. Learn more.