From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ed1-f47.google.com (mail-ed1-f47.google.com [209.85.208.47]) by sourceware.org (Postfix) with ESMTPS id DB210384640C for ; Mon, 31 Aug 2020 15:11:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org DB210384640C Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=rtems.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=joel.sherrill@gmail.com Received: by mail-ed1-f47.google.com with SMTP id l63so5765620edl.9 for ; Mon, 31 Aug 2020 08:11:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:reply-to:from:date:message-id :subject:to; bh=01RFQeDIiH33Ons4lfl/PQVDQuUZLDxgy9F57ehRmB4=; b=VlR0O8RIkK8ZidEZGdUZyOVyG6W4POTZy8qmituvnGnzjy+LilQ+80kQZ9ohYwt2ll 6MxF4JWg1G59jxdlSIlqFHsLiuf0fXNwS3teWMOPRoa7r+858iHGsCscbspQEvCy5BAP 4wh4q01SItGuXoBJhvOPs2CTIiudaSFeAvQ1NPaS2BTl3j+NGj/uDLmbuTzsBhb6yfUN HQfK6bw5e2k3LI3XoFsD3YEbAKMJw7rZa85KEEjvDvKdxGcWSksC3j4RIz7+FlhwHsIF c3V3gpFlJh9sVXTOiMCruCxkMwrVX/ULMi0WZypD+JVcMSODTt46daau8AymAgbg5Agx P3IQ== X-Gm-Message-State: AOAM532Wgr+f8bxYENhZgL0XkB2g8Nhl9GOhb/HZbbw1vNI7gi63YqkH QOHrQJ9NzLwL46/cKNDtAqVwoYIjAto= X-Google-Smtp-Source: ABdhPJy1F+blEXNsA6HOACcOFEc+ZYWJaLwRnoWtvs4cSkd2oLSa9epi+jOTeUfQF6gK2gQ1n+pSlw== X-Received: by 2002:aa7:d7ca:: with SMTP id e10mr1581124eds.191.1598886666549; Mon, 31 Aug 2020 08:11:06 -0700 (PDT) Received: from mail-ed1-f46.google.com (mail-ed1-f46.google.com. [209.85.208.46]) by smtp.gmail.com with ESMTPSA id lg22sm8589676ejb.48.2020.08.31.08.11.06 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 31 Aug 2020 08:11:06 -0700 (PDT) Received: by mail-ed1-f46.google.com with SMTP id l23so5764394edv.11 for ; Mon, 31 Aug 2020 08:11:06 -0700 (PDT) X-Received: by 2002:aa7:d606:: with SMTP id c6mr1028828edr.370.1598886666117; Mon, 31 Aug 2020 08:11:06 -0700 (PDT) MIME-Version: 1.0 Reply-To: joel@rtems.org From: Joel Sherrill Date: Mon, 31 Aug 2020 10:10:54 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Feature Conditional for M_PI To: Newlib X-Spam-Status: No, score=-3032.0 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, HTML_MESSAGE, KAM_DMARC_STATUS, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: newlib@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Newlib mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 Aug 2020 15:11:10 -0000 Hi I was porting some code from Linux to Cygwin and came across this. M_PI in math.h is defined by POSIX as part of XSI. It does not appear to be part of C99 or C++03. I have this cut down to show the problem: ========================== #include double pi = M_PI; ========================== And this script to try various feature defines and compilers: =========================== GCC=${GCC:-g++} ${GCC} -c m.c ${GCC} -D_XOPEN_SOURCE=700 -c m.c ${GCC} -D_POSIX_C_SOURCE=200809L -c m.c ${GCC} -D_XOPEN_SOURCE=700 -c -D_POSIX_C_SOURCE=200809L -c m.c =========================== All of those compiler invocations work on Linux but the third one does not work on Cygwin or RTEMS which use newlib. Is the proper thing to do to add -D_XOPEN_SOURCE=700 when compiling this program? Just curious if Linux is defining _XOPEN_SOURCE by default and newlib doesn't. Not sure what's the right answer. So asking. Thanks --joel