From patchwork Tue Mar 1 17:41:42 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Pedro Alves X-Patchwork-Id: 11160 Received: (qmail 33285 invoked by alias); 1 Mar 2016 17:41:47 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 33261 invoked by uid 89); 1 Mar 2016 17:41:46 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=1714, STEP, UD:watchpoint-fork.exp, sk:watchpo X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Tue, 01 Mar 2016 17:41:44 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (Postfix) with ESMTPS id B7D111837 for ; Tue, 1 Mar 2016 17:41:43 +0000 (UTC) Received: from cascais.lan (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u21HfgGl019428 for ; Tue, 1 Mar 2016 12:41:43 -0500 From: Pedro Alves To: gdb-patches@sourceware.org Subject: [pushed] Fix gdb.threads/watchpoint-fork*.c compilation Date: Tue, 1 Mar 2016 17:41:42 +0000 Message-Id: <1456854102-15879-1-git-send-email-palves@redhat.com> MIME-Version: 1.0 This testcase currently fails to compile on Fedora 23: .../src/gdb/testsuite/gdb.threads/watchpoint-fork-mt.c: In function 'start': .../src/gdb/testsuite/gdb.threads/watchpoint-fork-mt.c:70:11: warning: implicit declaration of function 'pthread_yield' [-Wimplicit-function-declaration] i = pthread_yield (); ^ .../src/gdb/testsuite/gdb.threads/watchpoint-fork-child.c: In function 'forkoff': .../src/gdb/testsuite/gdb.threads/watchpoint-fork-child.c:114:8: warning: implicit declaration of function 'pthread_yield' [-Wimplicit-function-declaratio n] i = pthread_yield (); ^ /tmp/ccUkNIsI.o: In function `start': .../src/gdb/testsuite/gdb.threads/watchpoint-fork-mt.c:70: undefined reference to `pthread_yield' (...) collect2: error: ld returned 1 exit status UNSUPPORTED: gdb.threads/watchpoint-fork.exp: child: multithreaded: Couldn't compile watchpoint-fork-child.c: unrecognized error UNTESTED: gdb.threads/watchpoint-fork.exp: child: multithreaded: watchpoint-fork.exp testcase .../src/gdb/testsuite/gdb.threads/watchpoint-fork.exp completed i The glibc manual says, on _GNU_SOURCE: "You should define these macros by using ‘#define’ preprocessor directives at the top of your source code files. These directives must come before any #include of a system header file." I instead put it in the header all the .c files of the testcase must include anyway. gdb/testsuite/ChangeLog: 2016-03-01 Pedro Alves * gdb.threads/watchpoint-fork-child.c: Include "watchpoint-fork.h" before anything else. * gdb.threads/watchpoint-fork-mt.c: Likewise. Don't define _GNU_SOURCE here. * gdb.threads/watchpoint-fork-st.c: Include "watchpoint-fork.h" before anything else. * gdb.threads/watchpoint-fork.h: Define _GNU_SOURCE. --- gdb/testsuite/ChangeLog | 10 ++++++++++ gdb/testsuite/gdb.threads/watchpoint-fork-child.c | 4 ++-- gdb/testsuite/gdb.threads/watchpoint-fork-mt.c | 7 ++----- gdb/testsuite/gdb.threads/watchpoint-fork-st.c | 4 ++-- gdb/testsuite/gdb.threads/watchpoint-fork.h | 3 +++ 5 files changed, 19 insertions(+), 9 deletions(-) diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 49e87bc..c992a59 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,5 +1,15 @@ 2016-03-01 Pedro Alves + * gdb.threads/watchpoint-fork-child.c: Include "watchpoint-fork.h" + before anything else. + * gdb.threads/watchpoint-fork-mt.c: Likewise. Don't define + _GNU_SOURCE here. + * gdb.threads/watchpoint-fork-st.c: Include "watchpoint-fork.h" + before anything else. + * gdb.threads/watchpoint-fork.h: Define _GNU_SOURCE. + +2016-03-01 Pedro Alves + * gdb.base/catch-fork-kill.c: Include . 2016-03-01 Yao Qi diff --git a/gdb/testsuite/gdb.threads/watchpoint-fork-child.c b/gdb/testsuite/gdb.threads/watchpoint-fork-child.c index 92ca0e5..b84a122 100644 --- a/gdb/testsuite/gdb.threads/watchpoint-fork-child.c +++ b/gdb/testsuite/gdb.threads/watchpoint-fork-child.c @@ -17,6 +17,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, see . */ +#include "watchpoint-fork.h" + #include #include #include @@ -24,8 +26,6 @@ #include #include -#include "watchpoint-fork.h" - /* `pid_t' may not be available. */ static volatile int usr1_got; diff --git a/gdb/testsuite/gdb.threads/watchpoint-fork-mt.c b/gdb/testsuite/gdb.threads/watchpoint-fork-mt.c index f603b6d..bc967ce 100644 --- a/gdb/testsuite/gdb.threads/watchpoint-fork-mt.c +++ b/gdb/testsuite/gdb.threads/watchpoint-fork-mt.c @@ -17,22 +17,19 @@ You should have received a copy of the GNU General Public License along with this program; if not, see . */ +#include "watchpoint-fork.h" + #include #include #include #include #include - -/* pthread_yield is a GNU extension. */ -#define _GNU_SOURCE #include #include #include #define gettid() syscall (__NR_gettid) -#include "watchpoint-fork.h" - /* Non-atomic `var++' should not hurt as we synchronize the threads by the STEP variable. Hit-comments need to be duplicated there to catch both at-stops and behind-stops, depending on the target. */ diff --git a/gdb/testsuite/gdb.threads/watchpoint-fork-st.c b/gdb/testsuite/gdb.threads/watchpoint-fork-st.c index 41ddf13..bd3a3f2 100644 --- a/gdb/testsuite/gdb.threads/watchpoint-fork-st.c +++ b/gdb/testsuite/gdb.threads/watchpoint-fork-st.c @@ -17,14 +17,14 @@ You should have received a copy of the GNU General Public License along with this program; if not, see . */ +#include "watchpoint-fork.h" + #include #include #include #include #include -#include "watchpoint-fork.h" - volatile int var; void diff --git a/gdb/testsuite/gdb.threads/watchpoint-fork.h b/gdb/testsuite/gdb.threads/watchpoint-fork.h index 8ea1937..87307ae 100644 --- a/gdb/testsuite/gdb.threads/watchpoint-fork.h +++ b/gdb/testsuite/gdb.threads/watchpoint-fork.h @@ -17,6 +17,9 @@ You should have received a copy of the GNU General Public License along with this program; if not, see . */ +/* pthread_yield is a GNU extension. */ +#define _GNU_SOURCE + #ifdef THREAD #include