From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 3FAAA3858D32 for ; Mon, 19 Jun 2023 09:00:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 3FAAA3858D32 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687165209; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references; bh=kZ1XtisPrwDpWQtvMWaGWF5OrhFjrAtHMjqjIaP3uPk=; b=OqhRhVbALQa66K7vJV9D840O5zRUenpNqgqTItH4riZZfeIiPIMQfyBhoRbWHnWEVcMeAI so0q/FP98jzSegXkZLKjMiL9P24JPauIGErA4rqxjlM5km/Fu99PNx/q2UxJhOfbcgZSYK fhAseinjqUOXxx7yaP8eL9rEGygi5Sk= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-570-BUxu9cG1McuSLgddWEftvA-1; Mon, 19 Jun 2023 05:00:05 -0400 X-MC-Unique: BUxu9cG1McuSLgddWEftvA-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 4C2D53C0D187; Mon, 19 Jun 2023 09:00:05 +0000 (UTC) Received: from calimero.vinschen.de (unknown [10.39.195.105]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2B7571415102; Mon, 19 Jun 2023 09:00:05 +0000 (UTC) Received: by calimero.vinschen.de (Postfix, from userid 500) id 26D08A80C74; Mon, 19 Jun 2023 11:00:04 +0200 (CEST) Date: Mon, 19 Jun 2023 11:00:04 +0200 From: Corinna Vinschen To: Mingye Wang Cc: newlib@sourceware.org Subject: Re: [Bug?] SIG2STR_MAX not good for #if Message-ID: Reply-To: newlib@sourceware.org Mail-Followup-To: Mingye Wang , newlib@sourceware.org References: MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Disposition: inline X-Spam-Status: No, score=-5.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,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 List-Id: On Jun 19 14:15, Mingye Wang wrote: > When building schilytools on MSYS2, I got hit with: > > ``` > defs.h:1288:21: error: missing binary operator before token "(" > 1288 | #if NUMBUFLEN < SIG2STR_MAX > ``` > > For context, the source goes: > > ``` > #define NUMBUFLEN 21 /* big enough for 64 bits */ > #if NUMBUFLEN < SIG2STR_MAX > #undef NUMBUFLEN > #define NUMBUFLEN (SIG2STR_MAX-1) > #endif > ``` > > A cursory inspection of /usr/include leads me to this "#define > SIG2STR_MAX (sizeof("RTMAX+") + sizeof("4294967295") - 1)" definition; > redefining it with a plain number makes the build go through. Looking > up the newlib source code, it appears that the definition is not > specific to MSYS2 or Cygwin, but common to all newlib distributions. > > The wording proposed for SIG2STR_MAX by geoffclare in comment 4975[1] > under the POSIX issue 8 bug report requires that the definition is > suitable for #if, which newlib currently violates. Now this isn't > quite standard yet and is subject to change, so I can't say for sure > this is newlib's bug. > > [1]: https://www.austingroupbugs.net/view.php?id=1138#c4975 We could redefine SIG2STR_MAX as static values (still dependent on __SIZEOF_INT__) and prepend the sizeof expressions as comments. Do you want to provide a patch? Thanks, Corinna