testsuite, c++: Skip contracts run tests for non-hosted.

These, in general, require hosted support.

gcc/testsuite/ChangeLog:

	* g++.dg/contracts/cpp26/basic.contract.eval.p11-observe.C: Skip
	for non-hosted.
	* g++.dg/contracts/cpp26/basic.contract.eval.p17-2.C: Likewise.
	* g++.dg/contracts/cpp26/basic.contract.eval.p17-3.C: Likewise.
	* g++.dg/contracts/cpp26/basic.contract.eval.p17-4.C: Likewise.
	* g++.dg/contracts/cpp26/basic.contract.eval.p17-5.C: Likewise.
	* g++.dg/contracts/cpp26/basic.contract.eval.p17-SMF-post.C: Likewise.
	* g++.dg/contracts/cpp26/basic.contract.eval.p17-SMF-pre.C: Likewise.
	* g++.dg/contracts/cpp26/basic.contract.eval.p17-SMF2.C: Likewise.
	* g++.dg/contracts/cpp26/basic.contract.eval.p17-SMF3.C: Likewise.
	* g++.dg/contracts/cpp26/basic.contract.eval.p17-SMF4.C: Likewise.
	* g++.dg/contracts/cpp26/basic.contract.eval.p17.C: Likewise.
	* g++.dg/contracts/cpp26/basic.contract.eval.p4.C: Likewise.
	* g++.dg/contracts/cpp26/basic.contract.eval.p6.observe.C: Likewise.
	* g++.dg/contracts/cpp26/callerside-checks/callerside-checks-all.C: Likewise.
	* g++.dg/contracts/cpp26/callerside-checks/callerside-checks-none.C: Likewise.
	* g++.dg/contracts/cpp26/callerside-checks/callerside-checks-pre.C: Likewise.
	* g++.dg/contracts/cpp26/callerside-checks/freefunc-noexcept-post.C: Likewise.
	* g++.dg/contracts/cpp26/callerside-checks/freefunc-noexcept-pre.C: Likewise.
	* g++.dg/contracts/cpp26/contract-assert-run.C: Likewise.
	* g++.dg/contracts/cpp26/contract-violation-noexcept2.C: Likewise.
	* g++.dg/contracts/cpp26/debug-and-opt.C: Likewise.
	* g++.dg/contracts/cpp26/deferred1.C: Likewise.
	* g++.dg/contracts/cpp26/definition-checks/contract-assert-no-def-check.C: Likewise.
	* g++.dg/contracts/cpp26/dependent_contract.C: Likewise.
	* g++.dg/contracts/cpp26/empty-nt-param.C: Likewise.
	* g++.dg/contracts/cpp26/expr.prim.id.unqual.p7-3.C: Likewise.
	* g++.dg/contracts/cpp26/expr.prim.id.unqual.p7-4.C: Likewise.
	* g++.dg/contracts/cpp26/function-contract-specifier-seq.C: Likewise.
	* g++.dg/contracts/cpp26/name_mangling.C: Likewise.
	* g++.dg/contracts/cpp26/outline-checks/freefunc-noexcept-post.C: Likewise.
	* g++.dg/contracts/cpp26/outline-checks/freefunc-noexcept-pre.C: Likewise.
	* g++.dg/contracts/cpp26/outline-checks/func-noexcept-assert.C: Likewise.
	* g++.dg/contracts/cpp26/outline-checks/memberfunc-noexcept-post.C: Likewise.
	* g++.dg/contracts/cpp26/outline-checks/memberfunc-noexcept-pre.C: Likewise.
	* g++.dg/contracts/cpp26/src-loc-0.C: Likewise.
	* g++.dg/contracts/cpp26/src-loc-1.C: Likewise.
	* g++.dg/contracts/cpp26/src-loc-2.C: Likewise.
	* g++.dg/contracts/cpp26/throwing-violation-handler.cc: Likewise.
	* g++.dg/contracts/cpp26/vaargs.C: Likewise.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
This commit is contained in:
Iain Sandoe
2026-01-31 20:45:23 +00:00
parent bbc4d2e15c
commit 8b6e123e24
39 changed files with 40 additions and 8 deletions

View File

@@ -10,6 +10,7 @@
//
// { dg-do run { target c++26 } }
// { dg-additional-options "-fcontracts -fcontract-evaluation-semantic=observe" }
// { dg-skip-if "requires hosted libstdc++ for stdc++exp" { ! hostedlib } }
int f(int i, int j = 1) pre(i > 0) post(r: r < 5)
{

View File

@@ -7,6 +7,7 @@
// invoked (14.6.2). — end note]
// { dg-do run { target c++26 } }
// { dg-additional-options "-fcontracts -fcontract-evaluation-semantic=observe " }
// { dg-skip-if "requires hosted libstdc++ for stdc++exp" { ! hostedlib } }
#include <contracts>
#include <exception>

View File

@@ -6,6 +6,7 @@
// for a handler continues from the execution of that statement. — end note]
// { dg-do run { target c++26 } }
// { dg-additional-options "-fcontracts -fcontract-evaluation-semantic=observe " }
// { dg-skip-if "requires hosted libstdc++ for stdc++exp" { ! hostedlib } }
#include <contracts>
#include <exception>

View File

@@ -10,6 +10,7 @@
//
// { dg-do run { target c++26 } }
// { dg-additional-options "-fcontracts -fcontract-evaluation-semantic=observe " }
// { dg-skip-if "requires hosted libstdc++ for stdc++exp" { ! hostedlib } }
#include <contracts>
#include <exception>

View File

@@ -10,6 +10,7 @@
//
// { dg-do run { target c++26 } }
// { dg-additional-options "-fcontracts -fcontract-evaluation-semantic=observe " }
// { dg-skip-if "requires hosted libstdc++ for stdc++exp" { ! hostedlib } }
#include <contracts>
#include <exception>

View File

@@ -11,6 +11,7 @@
//
// { dg-do run { target c++26 } }
// { dg-additional-options "-fcontracts -fcontract-evaluation-semantic=observe " }
// { dg-skip-if "requires hosted libstdc++ for stdc++exp" { ! hostedlib } }
#include <contracts>
#include <exception>

View File

@@ -11,6 +11,7 @@
//
// { dg-do run { target c++26 } }
// { dg-additional-options "-fcontracts -fcontract-evaluation-semantic=observe " }
// { dg-skip-if "requires hosted libstdc++ for stdc++exp" { ! hostedlib } }
#include <contracts>
#include <exception>

View File

@@ -10,6 +10,7 @@
//
// { dg-do run { target c++26 } }
// { dg-additional-options "-fcontracts -fcontract-evaluation-semantic=observe " }
// { dg-skip-if "requires hosted libstdc++ for stdc++exp" { ! hostedlib } }
#include <contracts>
#include <exception>

View File

@@ -10,6 +10,7 @@
//
// { dg-do run { target c++26 } }
// { dg-additional-options "-fcontracts -fcontract-evaluation-semantic=observe " }
// { dg-skip-if "requires hosted libstdc++ for stdc++exp" { ! hostedlib } }
#include <contracts>
#include <exception>

View File

@@ -11,6 +11,7 @@
//
// { dg-do run { target c++26 } }
// { dg-additional-options "-fcontracts -fcontract-evaluation-semantic=observe " }
// { dg-skip-if "requires hosted libstdc++ for stdc++exp" { ! hostedlib } }
#include <contracts>
#include <exception>

View File

@@ -7,6 +7,7 @@
// invoked (14.6.2). — end note]
// { dg-do run { target c++26 } }
// { dg-additional-options "-fcontracts -fcontract-evaluation-semantic=observe " }
// { dg-skip-if "requires hosted libstdc++ for stdc++exp" { ! hostedlib } }
#include <contracts>
#include <exception>

View File

@@ -4,6 +4,7 @@
// [Note 2 : The predicate is potentially evaluated (6.3), but not evaluated. — end note]
// { dg-do run { target c++26 } }
// { dg-additional-options "-fcontracts -fcontract-evaluation-semantic=ignore" }
// { dg-skip-if "requires hosted libstdc++ for stdc++exp" { ! hostedlib } }
#include <contracts>

View File

@@ -6,7 +6,6 @@
// { dg-do compile { target c++26 } }
// { dg-additional-options "-fcontracts -fcontract-evaluation-semantic=observe -fdump-tree-gimple " }
int main(int ac, char *av[])
{
int i = ac;

View File

@@ -1,6 +1,6 @@
// { dg-do run { target c++20 } }
// { dg-additional-options "-fcontracts -fcontract-evaluation-semantic=observe -fcontracts-client-check=all" }
// { dg-skip-if "requires hosted libstdc++ for stdc++exp" { ! hostedlib } }
int f(const int a, const int b) pre (a > 2) post(r : r > 2){ return b; }

View File

@@ -1,5 +1,7 @@
// { dg-do run { target c++26 } }
// { dg-additional-options "-fcontracts -fcontracts-client-check=none" }
// { dg-skip-if "requires hosted libstdc++ for stdc++exp" { ! hostedlib } }
static int pre_check = 0;
bool fpre()
{

View File

@@ -1,5 +1,6 @@
// { dg-do run { target c++26 } }
// { dg-additional-options "-fcontracts -fcontracts-client-check=pre" }
// { dg-skip-if "requires hosted libstdc++ for stdc++exp" { ! hostedlib } }
static int pre_check = 0;
bool fpre()

View File

@@ -4,6 +4,7 @@
// with caller side checks.
// { dg-do run { target c++26 } }
// { dg-additional-options "-fcontracts -fcontract-evaluation-semantic=observe -fcontracts-client-check=all " }
// { dg-skip-if "requires hosted libstdc++ for stdc++exp" { ! hostedlib } }
#include <contracts>
#include <iostream>

View File

@@ -4,6 +4,7 @@
// with caller side checks.
// { dg-do run { target c++26 } }
// { dg-additional-options "-fcontracts -fcontract-evaluation-semantic=observe -fcontracts-client-check=all " }
// { dg-skip-if "requires hosted libstdc++ for stdc++exp" { ! hostedlib } }
#include <contracts>
#include <iostream>

View File

@@ -9,6 +9,7 @@
// ensure that a missing colon after contract role errors
// { dg-do run { target c++26 } }
// { dg-additional-options "-fcontracts -fcontract-evaluation-semantic=observe" }
// { dg-skip-if "requires hosted libstdc++ for stdc++exp" { ! hostedlib } }
#include <iostream>
#include <contracts>

View File

@@ -2,6 +2,7 @@
// { dg-do run { target c++26 } }
// { dg-additional-options "-fcontracts" }
// { dg-additional-sources "throwing-violation-handler.cc" }
// { dg-skip-if "requires hosted libstdc++ for stdc++exp" { ! hostedlib } }
#include <exception>

View File

@@ -1,7 +1,7 @@
// Check that we do not ICE with debug + optimisation.
// { dg-do run { target c++23 } }
// { dg-additional-options "-fcontracts -fcontract-evaluation-semantic=observe -O -g" }
// { dg-skip-if "requires hosted libstdc++ for stdc++exp" { ! hostedlib } }
int foo (const int i)
pre (i > 3)

View File

@@ -2,6 +2,7 @@
// For now, diagnose that we at least don't accidentally merge the contracts
// { dg-do run { target c++23 } }
// { dg-additional-options "-fcontracts -g3" }
// { dg-skip-if "requires hosted libstdc++ for stdc++exp" { ! hostedlib } }
#include <cassert>
struct contract
{

View File

@@ -2,6 +2,7 @@
// are turned off
// { dg-do run { target c++26 } }
// { dg-options "-fcontracts -fcontracts-definition-check=off -fcontract-evaluation-semantic=observe" }
// { dg-skip-if "requires hosted libstdc++ for stdc++exp" { ! hostedlib } }
#include <cstdlib>

View File

@@ -1,6 +1,7 @@
// check that dependent contract check does not cause an ICE
// { dg-do run { target c++23 } }
// { dg-additional-options "-fcontracts -fcontract-evaluation-semantic=observe " }
// { dg-skip-if "requires hosted libstdc++ for stdc++exp" { ! hostedlib } }
template <typename ST>
struct S{

View File

@@ -1,6 +1,7 @@
// check that we do not ICE with an empty nontrivial parameter
// { dg-do run { target c++23 } }
// { dg-additional-options "-fcontracts -fcontract-checks-outlined" }
// { dg-skip-if "requires hosted libstdc++ for stdc++exp" { ! hostedlib } }
struct NTClass {
NTClass(){};

View File

@@ -8,6 +8,7 @@
// { dg-do run { target c++26 } }
// { dg-additional-options "-fcontracts -fcontract-checks-outlined" }
// { dg-xfail-run-if "PRXXXXXX" { *-*-* } }
// { dg-skip-if "requires hosted libstdc++ for stdc++exp" { ! hostedlib } }
struct S{
S(){};

View File

@@ -8,6 +8,7 @@
// { dg-do run { target c++23 } }
// { dg-additional-options "-fcontracts -fcontract-evaluation-semantic=observe -O2 -g" }
// { dg-xfail-run-if "PRXXXXXX" { *-*-* } { "-fcontract-checks-outlined" } "" }
// { dg-skip-if "requires hosted libstdc++ for stdc++exp" { ! hostedlib } }
#include <cassert>

View File

@@ -10,7 +10,6 @@
// post attribute-specifier-seq opt ( result-name-introducer opt conditional-expression )
// { dg-do compile { target c++23 } }
// { dg-additional-options "-fcontracts" }
// { dg-additional-options "-fcontracts" }
static_assert (__cpp_contracts >= 202502L);

View File

@@ -3,7 +3,7 @@
// additional parameter that matches the returen value of the first function
// { dg-do run { target c++23 } }
// { dg-additional-options "-fcontracts -fcontract-evaluation-semantic=observe " }
// { dg-skip-if "requires hosted libstdc++ for stdc++exp" { ! hostedlib } }
int f() post(r:r>1){ return 2;}
void f(int i) post(true){ }

View File

@@ -3,6 +3,7 @@
// This tests the behaviour of a pre condition on a member function
// { dg-do run { target c++26 } }
// { dg-additional-options "-fcontracts -fcontract-evaluation-semantic=observe -fcontract-checks-outlined" }
// { dg-skip-if "requires hosted libstdc++ for stdc++exp" { ! hostedlib } }
#include <contracts>
#include <exception>

View File

@@ -3,6 +3,7 @@
// This tests the behaviour of a pre condition on a member function
// { dg-do run { target c++26 } }
// { dg-additional-options "-fcontracts -fcontract-evaluation-semantic=observe -fcontract-checks-outlined" }
// { dg-skip-if "requires hosted libstdc++ for stdc++exp" { ! hostedlib } }
#include <contracts>
#include <exception>

View File

@@ -2,6 +2,7 @@
// can be caught by the function.
// { dg-do run { target c++26 } }
// { dg-additional-options "-fcontracts -fcontract-evaluation-semantic=observe -fcontract-checks-outlined" }
// { dg-skip-if "requires hosted libstdc++ for stdc++exp" { ! hostedlib } }
#include <contracts>
#include <exception>

View File

@@ -3,6 +3,7 @@
// This tests the behaviour of a post condition on a member function
// { dg-do run { target c++26 } }
// { dg-additional-options "-fcontracts -fcontract-evaluation-semantic=observe -fcontract-checks-outlined" }
// { dg-skip-if "requires hosted libstdc++ for stdc++exp" { ! hostedlib } }
#include <contracts>
#include <exception>

View File

@@ -3,6 +3,7 @@
// This tests the behaviour of a pre condition on a member function
// { dg-do run { target c++26 } }
// { dg-additional-options "-fcontracts -fcontract-evaluation-semantic=observe -fcontract-checks-outlined" }
// { dg-skip-if "requires hosted libstdc++ for stdc++exp" { ! hostedlib } }
#include <contracts>
#include <exception>

View File

@@ -1,6 +1,6 @@
// { dg-do run { target c++23 } }
// { dg-additional-options "-fcontracts -fcontract-evaluation-semantic=observe " }
// { dg-skip-if "requires hosted libstdc++ for stdc++exp" { ! hostedlib } }
// Test source location without including <source_location>
int

View File

@@ -1,5 +1,6 @@
// { dg-do run { target c++23 } }
// { dg-additional-options "-fcontracts -fcontract-evaluation-semantic=observe " }
// { dg-skip-if "requires hosted libstdc++ for stdc++exp" { ! hostedlib } }
// Test source location with #include <source_location>
#include <source_location>
@@ -15,4 +16,4 @@ int main ()
foo (9);
}
// { dg-output "contract violation in function int foo.int. at .*:8: x > 10.*(\n|\r\n|\r)" }
// { dg-output "contract violation in function int foo.int. at .*:9: x > 10.*(\n|\r\n|\r)" }

View File

@@ -1,5 +1,6 @@
// { dg-do run { target c++23 } }
// { dg-additional-options "-fcontracts -fcontract-evaluation-semantic=observe " }
// { dg-skip-if "requires hosted libstdc++ for stdc++exp" { ! hostedlib } }
// Test source location with a late inclusion of <source_location>
@@ -17,4 +18,4 @@ int main ()
foo (9);
}
// { dg-output "contract violation in function int foo.int. at .*:8: x > 10.*(\n|\r\n|\r)" }
// { dg-output "contract violation in function int foo.int. at .*:9: x > 10.*(\n|\r\n|\r)" }

View File

@@ -1,3 +1,4 @@
// { dg-skip-if "requires hosted libstdc++ for stdc++exp" { ! hostedlib } }
#include <contracts>
void handle_contract_violation(const std::contracts::contract_violation&)

View File

@@ -1,6 +1,7 @@
// Check contract assertion on a vaarg function
// { dg-do run { target c++23 } }
// { dg-additional-options "-fcontracts -fcontract-evaluation-semantic=enforce " }
// { dg-skip-if "requires hosted libstdc++ for stdc++exp" { ! hostedlib } }
#include <stdio.h>
#include <stdarg.h>
int simple_printf(const char* fmt, ...) pre (fmt != 0) post (r: r > 0)