From patchwork Tue Mar 18 15:27:02 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 144 Return-Path: X-Original-To: siddhesh@wilcox.dreamhost.com Delivered-To: siddhesh@wilcox.dreamhost.com Received: from homiemail-mx21.g.dreamhost.com (caibbdcaaahb.dreamhost.com [208.113.200.71]) by wilcox.dreamhost.com (Postfix) with ESMTP id BD7C53601A5 for ; Tue, 18 Mar 2014 08:27:19 -0700 (PDT) Received: by homiemail-mx21.g.dreamhost.com (Postfix, from userid 14307373) id 6A830C91401; Tue, 18 Mar 2014 08:27:19 -0700 (PDT) X-Original-To: glibc@patchwork.siddhesh.in Delivered-To: x14307373@homiemail-mx21.g.dreamhost.com Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by homiemail-mx21.g.dreamhost.com (Postfix) with ESMTPS id 3F35B1E99C1F for ; Tue, 18 Mar 2014 08:27:19 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:message-id:date:from:mime-version:to:subject :content-type:content-transfer-encoding; q=dns; s=default; b=km7 N7PsutKbYbvnjuTbGZKvnsY5KG9O4SGOlinEVTTmjK12Z3WxuV7W7UIo/2HjYYgZ n2fcschhgD91rHNvwZ6uZc4QhsSVFZ4FSW1/m3sJB93SiS/ak3BAFRljC1esQR9J G496ejGOM1m1DwS+fLeupmsLVMUhw7dM4wM94lOQ= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:message-id:date:from:mime-version:to:subject :content-type:content-transfer-encoding; s=default; bh=nufUxHBpV UTXibdk8tL0iMTW9Kc=; b=gBXsqkZrR4MzvrayXLq40omEAdM6eZedcq4oRyTPq SyhfDr8/xtfTVsEg5uxzXTsB0VasK1p1sCjoi9mVezO0qdVlLq8ki8LzvXvZFOSx OgYDv5y2JHzc7kcKsqWef/26+KI0+CQVi0QjkR55y48EPu7HeMxIGh93ghlqUMJH FE= Received: (qmail 22239 invoked by alias); 18 Mar 2014 15:27:17 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 22212 invoked by uid 89); 18 Mar 2014 15:27:14 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.8 required=5.0 tests=AWL, BAYES_00, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: e24smtp04.br.ibm.com Message-ID: <532865C6.6020300@linux.vnet.ibm.com> Date: Tue, 18 Mar 2014 12:27:02 -0300 From: Adhemerval Zanella User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.3.0 MIME-Version: 1.0 To: "GNU C. Library" Subject: [PATCH] Add stardard definition on conform processing X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 14031815-1820-0000-0000-000000230DAE X-DH-Original-To: glibc@patchwork.siddhesh.in Hi all, This patch adds the -std=c99 option when preprocessing the data files from the conform testcases. It fixes an issue where the compiler may split the 'macro bool' defition from stdbool.h-data in two lines and thus breaking the conform check. I found this issue by debugging an unexpected failure for stdbool while using GCC 4.8. By issuing: $ gcc -m64 -E -P -DISO99 -x c conform/data/stdbool.h-data macro bool macro-int-constant true {int} == 1 macro-int-constant false {int} == 0 macro-int-constant __bool_true_false_are_defined {int} == 1 The 'macro bool' is splitting in two lines. Talking with Joseph, it might be a compiler issue with the altivec bool definition and thus contended to PPC only (I haven't see it on x86_64). I'll open a GCC defect for it. Adding the -std=c99 fixes the macro processing. The 'c99' is uses because the data files uses '//' comments. To compare if any data files shows any different output while being processed with -std=c99 (which is not expected), I used to following script: --- #!/bin/bash DATAFOLDER=$1 TMPDIR=`mktemp -d` CC=gcc CPPFLAGS="-m64 -E -P -x c" STD="ISO ISO99 ISO11 POSIX XPG3 XPG4 UNIX98 XOPEN2K POSIX2008 XOPEN2K8" for datafile in `find $DATAFOLDER -iname *-data`; do for std in $STD; do $CC -D$std $CPPFLAGS $datafile > $TMPDIR/default.out $CC -D$std -std=c99 $CPPFLAGS $datafile > $TMPDIR/default-ansi.out echo "$datafile | $std" diff -u $TMPDIR/default.out $TMPDIR/default-ansi.out done done --- On x86_64 I saw no difference, while on PPC64 I noted: conform/data/stdbool.h-data | ISO99 --- /tmp/tmp.83hkqw56gU/default.out 2014-03-18 10:24:13.568094420 -0500 +++ /tmp/tmp.83hkqw56gU/default-ansi.out 2014-03-18 10:24:13.568094420 -0500 @@ -1,5 +1,4 @@ -macro - bool +macro bool macro-int-constant true {int} == 1 macro-int-constant false {int} == 0 macro-int-constant __bool_true_false_are_defined {int} == 1 conform/data/stdbool.h-data | ISO11 --- /tmp/tmp.83hkqw56gU/default.out 2014-03-18 10:24:13.578094445 -0500 +++ /tmp/tmp.83hkqw56gU/default-ansi.out 2014-03-18 10:24:13.578094445 -0500 @@ -1,5 +1,4 @@ -macro - bool +macro bool macro-int-constant true {int} == 1 macro-int-constant false {int} == 0 macro-int-constant __bool_true_false_are_defined {int} == 1 conform/data/stdbool.h-data | XOPEN2K --- /tmp/tmp.83hkqw56gU/default.out 2014-03-18 10:24:13.628094563 -0500 +++ /tmp/tmp.83hkqw56gU/default-ansi.out 2014-03-18 10:24:13.638094587 -0500 @@ -1,5 +1,4 @@ -macro - bool +macro bool macro-int-constant true {int} == 1 macro-int-constant false {int} == 0 macro-int-constant __bool_true_false_are_defined {int} == 1 conform/data/stdbool.h-data | POSIX2008 --- /tmp/tmp.83hkqw56gU/default.out 2014-03-18 10:24:13.638094587 -0500 +++ /tmp/tmp.83hkqw56gU/default-ansi.out 2014-03-18 10:24:13.648094611 -0500 @@ -1,5 +1,4 @@ -macro - bool +macro bool macro-int-constant true {int} == 1 macro-int-constant false {int} == 0 macro-int-constant __bool_true_false_are_defined {int} == 1 conform/data/stdbool.h-data | XOPEN2K8 --- /tmp/tmp.83hkqw56gU/default.out 2014-03-18 10:24:13.658094635 -0500 +++ /tmp/tmp.83hkqw56gU/default-ansi.out 2014-03-18 10:24:13.658094635 -0500 @@ -1,5 +1,4 @@ -macro - bool +macro bool macro-int-constant true {int} == 1 macro-int-constant false {int} == 0 macro-int-constant __bool_true_false_are_defined {int} == 1 Other files shows no difference. -- 2014-03-18 Adhemerval Zanella * conform/conformtest.pl: Add standard definition when calling C preprocessor on data files. (checknamespace): Remove unused variable. --- diff --git a/conform/conformtest.pl b/conform/conformtest.pl index 085fbb8..c8c1d2a 100644 --- a/conform/conformtest.pl +++ b/conform/conformtest.pl @@ -264,7 +264,6 @@ sub checknamespace { close (TESTFILE); undef %errors; - $nknown = 0; open (CONTENT, "$CC $CFLAGS_namespace -E $fnamebase.c -P -Wp,-dN | sed -e '/^# [1-9]/d' -e '/^[[:space:]]*\$/d' |"); loop: while () { chop; @@ -324,7 +323,7 @@ while ($#headers >= 0) { printf ("Testing <$h>\n"); printf ("----------" . "-" x length ($h) . "\n"); - open (CONTROL, "$CC -E -D$standard -x c data/$h-data |"); + open (CONTROL, "$CC -E -D$standard -std=c99 -x c data/$h-data |"); control: while () { chop; next control if (/^#/);