From patchwork Mon Jul 4 20:42:06 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Diego Novillo X-Patchwork-Id: 103166 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 968A4B6F57 for ; Tue, 5 Jul 2011 06:42:29 +1000 (EST) Received: (qmail 25068 invoked by alias); 4 Jul 2011 20:42:27 -0000 Received: (qmail 25059 invoked by uid 22791); 4 Jul 2011 20:42:26 -0000 X-SWARE-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, SPF_HELO_PASS, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from smtp-out.google.com (HELO smtp-out.google.com) (216.239.44.51) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 04 Jul 2011 20:42:10 +0000 Received: from kpbe18.cbf.corp.google.com (kpbe18.cbf.corp.google.com [172.25.105.82]) by smtp-out.google.com with ESMTP id p64Kg9ew025205; Mon, 4 Jul 2011 13:42:09 -0700 Received: from topo.tor.corp.google.com (topo.tor.corp.google.com [172.29.41.2]) by kpbe18.cbf.corp.google.com with ESMTP id p64Kg7xZ025770; Mon, 4 Jul 2011 13:42:08 -0700 Received: by topo.tor.corp.google.com (Postfix, from userid 54752) id F123B1DA1D1; Mon, 4 Jul 2011 16:42:06 -0400 (EDT) To: reply@codereview.appspotmail.com, crowl@google.com, gchare@google.com, gcc-patches@gcc.gnu.org Subject: [pph] Tweak some tests (issue4668052) Message-Id: <20110704204206.F123B1DA1D1@topo.tor.corp.google.com> Date: Mon, 4 Jul 2011 16:42:06 -0400 (EDT) From: dnovillo@google.com (Diego Novillo) X-System-Of-Record: true X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org This patch adds an assertion to x1ten-hellos to make sure that the loop counter is properly initialized and ends in 10. It also calls exit instead of return. In c1eabi1.h I forgot to surround the system function signatures in extern "C" {}. Tested on x86_64. Committed. Diego. * g++.dg/pph/c1eabi1.h: Surround system function prototypes with extern "C" {}. * g++.dg/pph/x1ten-hellos.cc (main): Tidy. Assert that i is 10 at the end of the loop. Call exit instead of 'return 0'. * g++.dg/pph/x1ten-hellos.h: Do not include stdio.h. --- This patch is available for review at http://codereview.appspot.com/4668052 diff --git a/gcc/testsuite/g++.dg/pph/c1eabi1.h b/gcc/testsuite/g++.dg/pph/c1eabi1.h index 77ebfa3..f43913f 100644 --- a/gcc/testsuite/g++.dg/pph/c1eabi1.h +++ b/gcc/testsuite/g++.dg/pph/c1eabi1.h @@ -33,11 +33,13 @@ /* Simplified version of c2eabi1.cc - Do not include other system headers here. Simply forward declare the library functions used by this header. */ -extern void abort(void); -extern int abs(int); -extern void exit(int); -extern double fabs(double); -extern int printf(const char *, ...); +extern "C" { + extern void abort(void); + extern int abs(int); + extern void exit(int); + extern double fabs(double); + extern int printf(const char *, ...); +} /* All these functions are defined to use the base ABI, so use the attribute to ensure the tests use the base ABI to call them even diff --git a/gcc/testsuite/g++.dg/pph/x1ten-hellos.cc b/gcc/testsuite/g++.dg/pph/x1ten-hellos.cc index 865b149..704b3fc 100644 --- a/gcc/testsuite/g++.dg/pph/x1ten-hellos.cc +++ b/gcc/testsuite/g++.dg/pph/x1ten-hellos.cc @@ -1,10 +1,17 @@ // { dg-do run } + #include "x1ten-hellos.h" int main(void) { A a; - for (int i = 0; i < 10; i++) + int i; + + for (i = 0; i < 10; i++) a.hello(); - return 0; + + if (i != 10) + abort (); + + exit (0); } diff --git a/gcc/testsuite/g++.dg/pph/x1ten-hellos.h b/gcc/testsuite/g++.dg/pph/x1ten-hellos.h index 2a53b66..c165c01 100644 --- a/gcc/testsuite/g++.dg/pph/x1ten-hellos.h +++ b/gcc/testsuite/g++.dg/pph/x1ten-hellos.h @@ -1,6 +1,10 @@ #ifndef A_H_ #define A_H_ -#include +extern "C" { + int printf(const char*, ...); + void abort(void); + void exit(int); +}; class A {