From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25767 invoked by alias); 17 Sep 2011 00:31:06 -0000 Received: (qmail 25758 invoked by uid 22791); 17 Sep 2011 00:31:05 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 17 Sep 2011 00:30:47 +0000 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=EU1-MAIL.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1R4inu-0004BP-Be from pedro_alves@mentor.com ; Fri, 16 Sep 2011 17:30:46 -0700 Received: from scottsdale.localnet ([172.16.63.104]) by EU1-MAIL.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.1830); Sat, 17 Sep 2011 01:30:43 +0100 From: Pedro Alves To: John Spencer Subject: Re: wrong assumptions about pthread_t being numeric Date: Sat, 17 Sep 2011 01:05:00 -0000 User-Agent: KMail/1.13.6 (Linux/2.6.38-11-generic; KDE/4.7.0; x86_64; ; ) Cc: gdb-patches@sourceware.org References: <4E73D06F.603@barfooze.de> <201109170000.43306.pedro@codesourcery.com> <4E73D806.2040302@barfooze.de> In-Reply-To: <4E73D806.2040302@barfooze.de> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201109170130.42276.pedro@codesourcery.com> X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2011-09/txt/msg00332.txt.bz2 On Saturday 17 September 2011 00:13:10, John Spencer wrote: > On 09/17/2011 01:00 AM, Pedro Alves wrote: > > > > These are only built natively on solaris and aix respectively, so > > let's just leave them alone. > > > > I expected it to be desirable for a product in industrial use to be > standard-compliant and not invoking undefined behavior. Those files are tied to those platforms' thread_db/libc implementations. There's absolutely no need to handle some other hipotetical libc that defines pthread_t diferently there. If it appears, we'll handle it. Chances are, some other changes would be necessary to make it really work, not just build. > >> thread-db.c: In function 'find_one_thread': > >> thread-db.c:295:7: error: format '%ld' expects type 'long int', but > >> argument 3 has type 'thread_t' > >> thread-db.c: In function 'attach_thread': > >> thread-db.c:335:7: error: format '%ld' expects type 'long int', but > >> argument 3 has type 'thread_t' > >> thread-db.c:341:9: error: format '%ld' expects type 'long int', but > >> argument 2 has type 'thread_t' > > So just cast it to long, and you're done. > > > > pthread_t could legally be a struct, which you can't just cast to a long. No need to complicate things for an hipotetical scenario. The set of libc's in existence is finite. If we were to handle a struct pthread_t, we'd need to be able to print it, and so we'd need some libc specific way to do it, something autoconf'ed. There's no need to invent work. -- Pedro Alves