From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/10234 Path: news.gmane.org!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: Fix warnings when build with clang Date: Mon, 27 Jun 2016 13:55:53 -0400 Message-ID: <20160627175553.GI10893@brightrain.aerifal.cx> References: <20160625093707.GA19691@port70.net> <36ad2a0f7443ff7e95b7e927b49a2a87@codeaurora.org> <20160627172159.GH10893@brightrain.aerifal.cx> <409e13bc-9e0c-9db6-977b-1a90b18d278e@gentoo.org> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1467050169 16491 80.91.229.3 (27 Jun 2016 17:56:09 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 27 Jun 2016 17:56:09 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-10247-gllmg-musl=m.gmane.org@lists.openwall.com Mon Jun 27 19:56:09 2016 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1bHalT-00087f-LZ for gllmg-musl@m.gmane.org; Mon, 27 Jun 2016 19:56:07 +0200 Original-Received: (qmail 7435 invoked by uid 550); 27 Jun 2016 17:56:05 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 7413 invoked from network); 27 Jun 2016 17:56:05 -0000 Content-Disposition: inline In-Reply-To: <409e13bc-9e0c-9db6-977b-1a90b18d278e@gentoo.org> User-Agent: Mutt/1.5.21 (2010-09-15) Original-Sender: Rich Felker Xref: news.gmane.org gmane.linux.lib.musl.general:10234 Archived-At: On Mon, Jun 27, 2016 at 07:41:49PM +0200, Luca Barbato wrote: > On 27/06/16 19:21, Rich Felker wrote: > > On Mon, Jun 27, 2016 at 10:01:52AM -0700, weimingz@codeaurora.org wrote: > >> On 2016-06-25 02:37, Szabolcs Nagy wrote: > >>> * Zhao, Weiming [2016-06-24 17:18:23 -0700]: > >>>> Clang gives warnings about the missing parentheses for bitwise ops. > >>>> > >>>> It's not functional but just code readability. > >>>> > >>>> musl-m3/include/endian.h:32:25: warning: '&' within '|' > >>>> [-Wbitwise-op-parentheses] > >>>> return __x>>24 | __x>>8&0xff00 | __x<<8&0xff0000 | __x<<24; > >>>> ~ ~~~~~~^~~~~~~ > >>> > >>> if clang warns about system headers that's a clang bug. > >> > >> The endian.h is a musl file. > > > > Right, which is why it's a system header. > > I'm not sure there is a simple way to know what's a system header and > what is not, beside keeping a list. If your compiler is automatically searching the right system header paths for the target, it's a non-issue. If not (if you have some hacked-together setup) then you should use -isystem rather than -I for the system header path. > And even in that case I'm not so sure the compiler should hide warnings > (no matter how fringe this actual warning is). The intent of style warning options (which this one is) is to warn about issues in the code being compiled, where it does not meet the policy set for the project being compiled. It's not to warn that libc does not meet your project's arbitrary style policies. This one happens to be turned on by -Wall I think, but there are lots of other style-policy warning options the user could turn on which musl's headers are cerainly not going to try to comply with, so the proper solution is for the compiler not to apply the style policy to them. Rich