From patchwork Tue Apr 19 17:03:05 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Arnaud Lacombe X-Patchwork-Id: 718531 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p3JH3AD1014496 for ; Tue, 19 Apr 2011 17:03:18 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752663Ab1DSRDI (ORCPT ); Tue, 19 Apr 2011 13:03:08 -0400 Received: from mail-iw0-f174.google.com ([209.85.214.174]:48288 "EHLO mail-iw0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752529Ab1DSRDH convert rfc822-to-8bit (ORCPT ); Tue, 19 Apr 2011 13:03:07 -0400 Received: by iwn34 with SMTP id 34so4939698iwn.19 for ; Tue, 19 Apr 2011 10:03:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=bQibSW5Bfsef7yTrLG6aU92FGzwWNVXIXP9be17rPoQ=; b=iiUdI0o55k1aSirxi2wPCtAR4f8UJDmZW8vo/V7D7jMrx2CUTHxCyMTYdtF4mhgPIG GhVSLWkKO0Me3302w/sdqQGJiD5cCwdD6GxPk6vowOZxlJkaj3nb4fxu5MXb4NRCylPZ Whga8tDKnbdW3X78CpPN1L/uM6gtjmKQYJJUo= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=BEUNSc+EyEf22+1Is+YutvwxJ2yFrbce/4ByrTh6RKumOxIb/4pXz+0YYFbc1AZhGQ xLXgQX/tltm1GFqQW6pz0brWldCKi7I0AVSwdIig2g4rd9shZfeNa6pNOO7Q1cLsUT8K tKCUK1AQ3XuIqJCs+hTwZGVJIpL0geOL9g+Ik= MIME-Version: 1.0 Received: by 10.42.95.1 with SMTP id d1mr8225944icn.254.1303232585767; Tue, 19 Apr 2011 10:03:05 -0700 (PDT) Received: by 10.42.200.15 with HTTP; Tue, 19 Apr 2011 10:03:05 -0700 (PDT) In-Reply-To: <4DAD5BCB.8010604@suse.cz> References: <20110410020923.GI4663@erwin> <20110410143153.GJ4663@erwin> <4DAD5BCB.8010604@suse.cz> Date: Tue, 19 Apr 2011 13:03:05 -0400 Message-ID: Subject: Re: [PATCH v2] kconfig/kbuild: define _POSIX_C_SOURCE From: Arnaud Lacombe To: Michal Marek Cc: Valentin Ochs , Roman Zippel , trivial@kernel.org, linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Tue, 19 Apr 2011 17:03:26 +0000 (UTC) Hi, On Tue, Apr 19, 2011 at 5:54 AM, Michal Marek wrote: > On 10.4.2011 16:31, Valentin Ochs wrote: >> On Sat, Apr 09, 2011 at 11:34:00PM -0400, Arnaud Lacombe wrote: >>> On Sat, Apr 9, 2011 at 10:09 PM, Valentin Ochs wrote: >>>> The three patched files use PATH_MAX without defining the required >>>> _POSIX_C_SOURCE feature test macro.  This prevents compilation with the >>>> musl libc.  The patch applies to 2.6.38.2. >>>> >>>> Changes since v1: >>>>  - fix scripts/kconfig/lex.zconf.c_shipped >>> this file is autogenerated from zconf.l, which should be updated as >>> well. I'm not sure how you searched for PATH_MAX, but you're still >>> missing `confdata.c' and `nconf.c'. > > Yes, please fix the bison parser and run make GENERATE_PARSER=1 > menuconfig to update the *_shipped files. > > >>> I had a quick look to different libc implementation, glibc and uClibc >>> default to _POSIX_C_SOURCE == 200112L, FreeBSD >8.0 defaults to >>> 200809L for >8.0, FreeBSD 7.x to 200112L. >> >> I got the value I used from the Open Group System Interfaces >> specification, but the musl author said that 200112L would be fine too. > > I suggest you use 200112L, so that it is a nop for glibc/uClibc builds. > Please also accompany it with a /* for PATH_MAX */ comment or so. > no it's not. Defining _POSIX_C_SOURCE disables automatic definition of a few features macros, see below. >> >>> None of these seems to requires _POSIX_C_SOURCE to define PATH_MAX, so >>> I'm not certain of the requirement of the change. >> >> While I don't want to appear like a language lawyer, the specification >> says that 'all symbols required by POSIX.1-2008 to appear when the >> header is included shall be made visible' when an application defines >> _POSIX_C_SOURCE. I guess the musl author interprets that as 'if you >> don't define the feature test macros, you're not getting PATH_MAX.' This >> does not seem to be incorrect behaviour to me. > > While I don't completely understand the motivation for such > super-pedantic libc implementation, the fact is that POSIX says one > should define this macro, so let's define it, it does not hurt us. > If we go that way, we should at least: Both introduces new warnings with the glibc shipped with fedora 14 relating to strdup(3) needing one of: _SVID_SOURCE, _BSD_SOURCE, _XOPEN_SOURCE, _POSIX_C_SOURCE>=200809L (for __USE_XOPEN2K8). -D_POSIX_C_SOURCE=200809L do not generate more warning, at least on my host. Just for reference, the second change fails anyway as `nconf' uses GNU extension of C99. - Arnaud > Michal > -- > To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at  http://vger.kernel.org/majordomo-info.html > --- To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/Makefile b/Makefile index d6592b6..0490413 100644 --- a/Makefile +++ b/Makefile @@ -233,7 +233,7 @@ CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \ HOSTCC = gcc HOSTCXX = g++ -HOSTCFLAGS = -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer +HOSTCFLAGS = -D_POSIX_C_SOURCE=200112L -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer HOSTCXXFLAGS = -O2 at best: index d6592b6..0490413 100644 --- a/Makefile +++ b/Makefile @@ -233,7 +233,7 @@ CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \ HOSTCC = gcc HOSTCXX = g++ -HOSTCFLAGS = -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer +HOSTCFLAGS = --std=c99 -D_POSIX_C_SOURCE=200112L -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer HOSTCXXFLAGS = -O2