[PATCH] D131464: [test] Make tests pass regardless of gnu++14/gnu++17 default

Fangrui Song via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 29 19:33:39 PDT 2022


MaskRay added inline comments.


================
Comment at: clang/test/CodeGenCXX/exception-spec-decay.cpp:1
-// RUN: %clang_cc1 -fcxx-exceptions -fexceptions %s -triple=i686-unknown-linux -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 %stdcxx_98- -fcxx-exceptions -fexceptions -Wno-dynamic-exception-spec %s -triple=i686-unknown-linux -emit-llvm -o - | FileCheck %s
 typedef int Array[10];
----------------
aaron.ballman wrote:
> Should we drop the `%stdcxx_98-` entirely from tests and not have any `-std` flag (e.g., no such flags tells lit to run the test in all language modes, eventually)?
The proposal is probably clean if we the majority of tests work with C++98, but I think we have accrued many tests which don't work with C++98 so we need directives like `%stdcxx_11-`.

Since C++98 is actually uncommon now. I prefer explicit `%stdcxx_98-` to indicate a test works with C++98.


================
Comment at: clang/test/CodeGenCXX/override-layout.cpp:1-9
+// RUN: %clang_cc1 -std=c++14 -w -fdump-record-layouts-simple %s > %t.layouts
+// RUN: %clang_cc1 -std=c++14 -w -fdump-record-layouts-simple %s > %t.before
+// RUN: %clang_cc1 -std=c++14 -w -DPACKED= -DALIGNED16= -fdump-record-layouts-simple -foverride-record-layout=%t.layouts %s > %t.after
 // RUN: diff -u %t.before %t.after
-// RUN: FileCheck %s < %t.after
+// RUN: FileCheck --check-prefixes=CHECK,PRE17 %s < %t.after
+
+// RUN: %clang_cc1 -std=c++17 -w -fdump-record-layouts-simple %s > %t.layouts
----------------
aaron.ballman wrote:
> Pre 14? Post 17?
Unfortunately, C++17 and C++20 have different behaviors. I haven't investigated why it is the case.


================
Comment at: clang/test/Layout/ms-x86-vtordisp.cpp:1-3
+// RUN: %clang_cc1 -std=c++14 -fno-rtti -fms-extensions -emit-llvm-only -triple i686-pc-win32 -fdump-record-layouts -fsyntax-only %s 2>&1 \
 // RUN:            | FileCheck %s
+// RUN: %clang_cc1 -std=c++14 -fno-rtti -fms-extensions -emit-llvm-only -triple x86_64-pc-win32 -fdump-record-layouts -fsyntax-only %s 2>/dev/null \
----------------
aaron.ballman wrote:
> Is this test specific to C++14?
This is similar to the previous -fdump-record-layouts test that the dump order is different across 14, 17, 20. I do now know whether there is something which should be improved to add the coverage.

For now I assume it is not this patch's responsibility to address it.


================
Comment at: clang/test/SemaCXX/libstdcxx_is_pod_hack.cpp:1
-// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++14 %s
 
----------------
aaron.ballman wrote:
> Is this one only for C++14 or should there be a range used instead?
This is a hack for presumably older language dialects. Switched to a range.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D131464



More information about the cfe-commits mailing list