Commit 37d0ffd5 by Tom de Vries Committed by Tom de Vries

[testsuite/guality] Don't use attribute used in pr45882.c for -O0

2018-06-30  Tom de Vries  <tdevries@suse.de>

	* gcc.dg/guality/guality.exp (guality_transform_options): New proc.
	(toplevel): Apply guality_transform_options on DG_TORTURE_OPTIONS and
	LTO_TORTURE_OPTIONS.
	* gcc.dg/guality/prevent-optimization.h: New file.
	* gcc.dg/guality/pr45882.c: Include prevent-optimization.h.
	(a): Replace __attribute__((used)) with ATTRIBUTE_USED.

From-SVN: r262270
parent f269206b
2018-06-30 Tom de Vries <tdevries@suse.de>
* gcc.dg/guality/guality.exp (guality_transform_options): New proc.
(toplevel): Apply guality_transform_options on DG_TORTURE_OPTIONS and
LTO_TORTURE_OPTIONS.
* gcc.dg/guality/prevent-optimization.h: New file.
* gcc.dg/guality/pr45882.c: Include prevent-optimization.h.
(a): Replace __attribute__((used)) with ATTRIBUTE_USED.
2018-06-30 Tom de Vries <tdevries@suse.de>
* gcc.dg/guality/pr45882.c (foo): Use relative line numbers.
* lib/gcc-dg.exp (dg-final): New proc.
* lib/gcc-gdb-test.exp (gdb-test): Add and handle additional line number
......
......@@ -48,6 +48,28 @@ if ![info exists ::env(GUALITY_GDB_NAME)] {
}
report_gdb $::env(GUALITY_GDB_NAME) [info script]
proc guality_transform_options { args } {
set res [list]
foreach opt [lindex $args 0] {
#
if { ! [regexp -- "-O0" $opt] } {
set opt "$opt -DPREVENT_OPTIMIZATION"
}
lappend res $opt
}
return $res
}
global DG_TORTURE_OPTIONS
set guality_dg_torture_options [guality_transform_options $DG_TORTURE_OPTIONS]
set guality_lto_torture_options [guality_transform_options $LTO_TORTURE_OPTIONS]
torture-init
set-torture-options \
$guality_dg_torture_options \
[list {}] \
$guality_lto_torture_options
if {[check_guality "
#include \"$srcdir/$subdir/guality.h\"
volatile long int varl = 6;
......@@ -65,4 +87,5 @@ if [info exists guality_gdb_name] {
unsetenv GUALITY_GDB_NAME
}
torture-finish
dg-finish
......@@ -2,8 +2,10 @@
/* { dg-do run } */
/* { dg-options "-g" } */
#include "prevent-optimization.h"
extern void abort (void);
int a[1024] __attribute__((used));
int a[1024] ATTRIBUTE_USED;
volatile short int v;
__attribute__((noinline,noclone,used)) int
......
/* Copyright (C) 2018 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3, or (at your option)
any later version.
GCC is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. */
#ifndef PREVENT_OPTIMIZATION_H
#define PREVENT_OPTIMIZATION_H
#ifdef PREVENT_OPTIMIZATION
#define ATTRIBUTE_USED __attribute__((used))
#else
#define ATTRIBUTE_USED
#endif
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment