[PATCH] D57086: Ignore trailing NullStmts in StmtExprs for GCC compatibility

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 5 08:04:18 PDT 2019


aaron.ballman added a comment.

In D57086#1551354 <https://reviews.llvm.org/D57086#1551354>, @domdom wrote:

> In D57086#1550514 <https://reviews.llvm.org/D57086#1550514>, @aaron.ballman wrote:
>
> > In D57086#1549632 <https://reviews.llvm.org/D57086#1549632>, @domdom wrote:
> >
> > > clang-format the patch
> >
> >
> > Thanks! Do you need someone to commit on your behalf?
>
>
> You are very welcome; thank you both for your comments!
>
> I do need someone to commit on my behalf :)


I'm sorry for the incredibly long delay in committing this for you -- I managed to lose track of this thread. I went to apply the changes today and get the following test failures when trying on Windows 10 x64:

  FAIL: Clang :: AST/ast-dump-stmt.c (152 of 11055)
  ******************** TEST 'Clang :: AST/ast-dump-stmt.c' FAILED ********************
  Script:
  --
  : 'RUN: at line 1';   c:\cmakebuilds\build\x64-debug\bin\clang.exe -cc1 -internal-isystem c:\cmakebuilds\build\x64-debug\lib\clang\9.0.0\include -nostdsysteminc -std=gnu11 -ast-dump C:\llvm\tools\clang\test\AST\ast-dump-stmt.c | c:\cmakebuilds\build\x64-debug\bin\filecheck.exe -strict-whitespace C:\llvm\tools\clang\test\AST\ast-dump-stmt.c
  --
  Exit Code: 1
  
  Command Output (stdout):
  --
  $ ":" "RUN: at line 1"
  $ "c:\cmakebuilds\build\x64-debug\bin\clang.exe" "-cc1" "-internal-isystem" "c:\cmakebuilds\build\x64-debug\lib\clang\9.0.0\include" "-nostdsysteminc" "-std=gnu11" "-ast-dump" "C:\llvm\tools\clang\test\AST\ast-dump-stmt.c"
  # command stderr:
  C:\llvm\tools\clang\test\AST\ast-dump-stmt.c:48:3: warning: expression result unused
    -T1;
    ^~~
  C:\llvm\tools\clang\test\AST\ast-dump-stmt.c:49:3: warning: expression result unused
    -T2;
    ^~~
  C:\llvm\tools\clang\test\AST\ast-dump-stmt.c:58:3: warning: expression result unused
    ~T1;
    ^~~
  C:\llvm\tools\clang\test\AST\ast-dump-stmt.c:59:3: warning: expression result unused
    ~T2;
    ^~~
  C:\llvm\tools\clang\test\AST\ast-dump-stmt.c:70:21: warning: expression result unused
    _Generic(i, int : 12);
                      ^~
  C:\llvm\tools\clang\test\AST\ast-dump-stmt.c:79:21: warning: expression result unused
    _Generic(i, int : 12, default : 0);
                      ^~
  C:\llvm\tools\clang\test\AST\ast-dump-stmt.c:90:34: warning: expression result unused
    _Generic(i, default : 0, int : 12);
                                   ^~
  C:\llvm\tools\clang\test\AST\ast-dump-stmt.c:101:21: warning: expression result unused
    _Generic(i, int : 12, float : 10, default : 100);
                      ^~
  C:\llvm\tools\clang\test\AST\ast-dump-stmt.c:142:3: warning: expression result unused
    0;
    ^
  C:\llvm\tools\clang\test\AST\ast-dump-stmt.c:288:8: warning: expression result unused
    for (b; b; b)
         ^
  C:\llvm\tools\clang\test\AST\ast-dump-stmt.c:288:14: warning: expression result unused
    for (b; b; b)
               ^
  C:\llvm\tools\clang\test\AST\ast-dump-stmt.c:367:17: warning: expression result unused
    ({int a = 10; a;});
                  ^
  C:\llvm\tools\clang\test\AST\ast-dump-stmt.c:375:3: warning: expression result unused
    ({int a = 10; a;;; });
    ^~~~~~~~~~~~~~~~~~~~~
  13 warnings generated.
  
  $ "c:\cmakebuilds\build\x64-debug\bin\filecheck.exe" "-strict-whitespace" "C:\llvm\tools\clang\test\AST\ast-dump-stmt.c"
  # command stderr:
  C:\llvm\tools\clang\test\AST\ast-dump-stmt.c:376:18: error: CHECK-NEXT: expected string not found in input
    // CHECK-NEXT: StmtExpr 0x{{[^ ]*}} <line:[[@LINE-1]]:3, col:22> 'int'
                   ^
  <stdin>:282:5: note: scanning from here
      `-StmtExpr 0x19f2d493d18 <line:375:3, col:23> 'int'
      ^
  <stdin>:282:5: note: with "@LINE-1" equal to "375"
      `-StmtExpr 0x19f2d493d18 <line:375:3, col:23> 'int'
      ^
  <stdin>:282:14: note: possible intended match here
      `-StmtExpr 0x19f2d493d18 <line:375:3, col:23> 'int'
               ^
  
  error: command failed with exit status: 1
  
  --

It looks like the column number is off by one, and I wasn't certain why. Can you look into that before I commit?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D57086/new/

https://reviews.llvm.org/D57086





More information about the cfe-commits mailing list