From patchwork Tue Feb 13 10:37:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rainer Orth X-Patchwork-Id: 200355 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:bc8a:b0:106:860b:bbdd with SMTP id dn10csp449120dyb; Tue, 13 Feb 2024 02:38:28 -0800 (PST) X-Google-Smtp-Source: AGHT+IFQiKSQL85DPnwNYwQVB+0wWadBLgR6PVgkxCaQHmMf0aXSsH9UUAyRgFYhpYOwLdUcA6Ut X-Received: by 2002:a05:6808:202a:b0:3c0:3a17:b9c4 with SMTP id q42-20020a056808202a00b003c03a17b9c4mr5140738oiw.6.1707820708330; Tue, 13 Feb 2024 02:38:28 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707820708; cv=pass; d=google.com; s=arc-20160816; b=AUcXnq5XYOMOvHl/oxD3aE1V81A07kZWZ2cQ9CrC5F0UdHGYnvy8wyBFbe76xVxgzb 74e+vuvdns6s7V/eNyME5MUJrmbCQCvGHBdgsyJJ5iEOe3b+3LF81CSv3QzOfkuHpZcr ONgft+4XuT1tJYnpyfQGkigcNqRw3/26l9H8nyqBtMEjy9+xpVBjda245vE74JcaX2jh SOQa9QEHY6SW2iccB1llCR3sZ2+Z6+/uRL1LIcAAxlwDBPMw2i4FfPK6AEfC/RyCmXYv DFLXF7Tsd6R7t7pQ8VMyo5fdGKDzWObYM/fVylxBvfb3iuQ1l6kPsT3HEwVf3UULq8VP ifQA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:mime-version:user-agent :message-id:date:subject:cc:to:from:dkim-signature:arc-filter :dmarc-filter:delivered-to; bh=wTOZtlf6n/q+L3dTIaqFFDp1eULNlIk6uy6yHUH5n0g=; fh=OPcpBN9p3NsZbEG04GsGzHeSJiy7BxaDCJ/ALhfORl8=; b=OxdLcgpv3B7uC7tiIwNYBauE1oV4hDYNoBclvHfagEMvKDj8Wma41wewcrmxZajTi2 5wEkwwWrCGV/vunbcDNuKq1HhFa0ZONtj7SpSAA7uWeYIqF74ZoD3EMHVyJzVEcWPGB+ KuN+I5dI17n6FT3E9FPDuVePCw5WvvIbd/c3FhbUy4raxOBrQdrCziuNnE1GZEZumQfF 15OFLTwXE/UoaQ68BZqy6kNsSoTFAq7Z1MRDeqYYbkISyqsbPcHMWDBKZxHXN2LbzhYM AAtst+LOHTcqOme+3yde7ksR/Qr3aDaDOEcfvyWUL86605uDRMuwBAry9zES+b7236cG h9Hg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@cebitec.uni-bielefeld.de header.s=20200306 header.b=SHfwgwPN; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" X-Forwarded-Encrypted: i=2; AJvYcCW5Uo5AC0WOQsrQEg+rMzpgcT80tqgk/uTotJms9HBDD/DerRJ0wE/sXH/+64QcwxlrWM82HZEtpsuzl7zszStW5nkjSg== Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id j1-20020ac86641000000b0042c574e2766si2308098qtp.727.2024.02.13.02.38.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Feb 2024 02:38:28 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@cebitec.uni-bielefeld.de header.s=20200306 header.b=SHfwgwPN; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 07FD2385841B for ; Tue, 13 Feb 2024 10:38:28 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from smtp.CeBiTec.Uni-Bielefeld.DE (smtp.CeBiTec.Uni-Bielefeld.DE [129.70.160.84]) by sourceware.org (Postfix) with ESMTPS id 83AB13858404 for ; Tue, 13 Feb 2024 10:37:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 83AB13858404 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=CeBiTec.Uni-Bielefeld.DE Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=cebitec.uni-bielefeld.de ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 83AB13858404 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=129.70.160.84 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707820671; cv=none; b=RQQ2HoaCVQTfgds83/roeWOAKdyu7vGLR9u0et0Mm4ch2oIaYp9Hvb8hNYdC2TT5LKjlOxD4YQhF5cZFYPh+9Xl7Onm7WmBxYz8TUCpFk9cRlU0+b6jfWb+o9z1SHvALRlgeFoFM7ib6+MiIWcvVd+UxnQjXW6MlumdMCwkzLEw= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707820671; c=relaxed/simple; bh=0+uLwgmXPkLi7uRWLkXgDcFeYwVtZOIWl7HC0I5nWpI=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=YJQ8I22tB7qDheDQNGCpRXNhKqc6vavzQZpf0CZzJgvjZCZliFEvhOkZozRKQQ88O7Ht6sFnh51yePF5QFPDpaEBEAxbfL2zO1AhRA/oYG8gXVBXMYABrvroGEtCEq+8bmUD+AGrzdfQahMPKkCREUWkQriBn6fdlgrmdC6WKCE= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from localhost (localhost [127.0.0.1]) by smtp.CeBiTec.Uni-Bielefeld.DE (Postfix) with ESMTP id 73146C068B; Tue, 13 Feb 2024 11:37:48 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d= cebitec.uni-bielefeld.de; h=content-type:content-type :mime-version:user-agent:message-id:date:date:subject:subject :from:from:received:received; s=20200306; t=1707820667; bh=0+uLw gmXPkLi7uRWLkXgDcFeYwVtZOIWl7HC0I5nWpI=; b=SHfwgwPN1jifC+EAk24F/ 0nr8dQ0PjhsGgLAFdM76hW2g2KxnelvnyXnlxwVPf9wX7cWxeYAefT6WievD4CjJ VSvH/5s5d3VPliIVW//2jFf3gH6lGhRKEqoMpKFQarjAexMupipOI8y5Y8dn8rCg rr+tqEs5D/vUB/ZzoWZU6FySu+3vTqGPS7sCNxmkdDkm4HEbpKk1F0Q+dQPUaxxc zeBc1EswuG3ai/GBpi43Z+XLjEgm9HmW5+0dUIzKstFU044DO/9uOiF4ti6g4552 9D4Uc5N6YvKJOggqK9ZG5ZX8DyXV38OP1xs2+QLLolN5S5++8HjPFwSqTwSvrq4c g== X-Virus-Scanned: amavisd-new at cebitec.uni-bielefeld.de Received: from smtp.CeBiTec.Uni-Bielefeld.DE ([127.0.0.1]) by localhost (smtp.cebitec.uni-bielefeld.de [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id vzb333xKl0rP; Tue, 13 Feb 2024 11:37:47 +0100 (CET) Received: from manam.CeBiTec.Uni-Bielefeld.DE (p5085539e.dip0.t-ipconnect.de [80.133.83.158]) (Authenticated sender: ro) by smtp.CeBiTec.Uni-Bielefeld.DE (Postfix) with ESMTPSA id BE0C2C00F7; Tue, 13 Feb 2024 11:37:47 +0100 (CET) From: Rainer Orth To: gcc-patches@gcc.gnu.org Cc: Gaius Mulley Subject: [PATCH] libgm2: Fix libm2iso/wraptime.cc compilation on Solaris Date: Tue, 13 Feb 2024 11:37:47 +0100 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1.90 (usg-unix-v) MIME-Version: 1.0 X-Spam-Status: No, score=-3791.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790779806717840642 X-GMAIL-MSGID: 1790779806717840642 As it turned out, my patch to complete the libgm2 autoconf macros works on both Linux/sparc64 and Linux/x86_64, but breaks Solaris bootstrap: /vol/gcc/src/hg/master/local/libgm2/libm2iso/wraptime.cc: In function 'int m2iso_wraptime_gettimeofday(void*, timezone*)': /vol/gcc/src/hg/master/local/libgm2/libm2iso/wraptime.cc:148:24: error: invalid conversion from 'void*' to 'timeval*' [-fpermissive] 148 | return gettimeofday (tv, tz); | ^~ | | | void* In file included from /usr/include/sys/select.h:27, from /usr/include/sys/types.h:665, from /vol/gcc/src/hg/master/local/libgm2/libm2iso/wraptime.cc:35: /usr/include/sys/time.h:444:18: note: initializing argument 1 of 'int gettimeofday(timeval*, void*)' 444 | int gettimeofday(struct timeval *_RESTRICT_KYWD, void *_RESTRICT_KYWD); | ^ /vol/gcc/src/hg/master/local/libgm2/libm2iso/wraptime.cc: In function 'int m2iso_wraptime_settimeofday(void*, timezone*)': /vol/gcc/src/hg/master/local/libgm2/libm2iso/wraptime.cc:165:24: error: invalid conversion from 'void*' to 'timeval*' [-fpermissive] 165 | return settimeofday (tv, tz); | ^~ | | | void* /usr/include/sys/time.h:431:18: note: initializing argument 1 of 'int settimeofday(timeval*, void*)' 431 | int settimeofday(struct timeval *, void *); | ^~~~~~~~~~~~~~~~ This happens because on Linux only HAVE_[GS]ETTIMEOFDAY is defined, while Solaris has both that and HAVE_STRUCT_TIMEZONE, selecting different implementations. Fixed by casting tv to struct timeval *. I thought about changing the signatures instead to take a struct timeval * instead, but that seemed risky given that there's a HAVE_STRUCT_TIMEVAL, so would probably break other targets. Bootstrapped without regressions on i386-pc-solaris2.11, sparc-sun-solaris2.11, and x86_64-pc-linux-gnu. Ok for trunk? Rainer # HG changeset patch # Parent 54196105ece9b22dbacfebb0bebd5c857cd5c19a libgm2: Fix libm2iso/wraptime.cc compilation on Solaris diff --git a/libgm2/libm2iso/wraptime.cc b/libgm2/libm2iso/wraptime.cc --- a/libgm2/libm2iso/wraptime.cc +++ b/libgm2/libm2iso/wraptime.cc @@ -145,7 +145,7 @@ EXPORT(KillTM) (struct tm *tv) extern "C" int EXPORT(gettimeofday) (void *tv, struct timezone *tz) { - return gettimeofday (tv, tz); + return gettimeofday ((struct timeval *) tv, tz); } #else extern "C" int @@ -162,7 +162,7 @@ EXPORT(gettimeofday) (void *tv, void *tz extern "C" int EXPORT(settimeofday) (void *tv, struct timezone *tz) { - return settimeofday (tv, tz); + return settimeofday ((struct timeval *) tv, tz); } #else extern "C" int