Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp1607763ybi; Sun, 16 Jun 2019 08:49:41 -0700 (PDT) X-Google-Smtp-Source: APXvYqwt0eO79dr+i2wsUl+40tbo+VXc3aTqG6ehJq1Dp785MCOPDyd2MEIAl4zC7YIl+RTs20Cw X-Received: by 2002:a17:902:59da:: with SMTP id d26mr43580162plj.306.1560700181777; Sun, 16 Jun 2019 08:49:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560700181; cv=none; d=google.com; s=arc-20160816; b=xrT36dSA0lYEjg3fER40RncUSKQ8s598aPiDCoAdUGxkewaI1FArBEpaPEm4Ts/Lv8 fKu5n8JgcE4atbwnJ5TKJ1t0DZkEemkRRogF69OMJQxYD2cB7R+HKfAm1yDKtFUEWMEK nUsqpvb0yuogPud28WXLTmaf8gV2Tl9oJf7SkFUr4SBJEpC9W6FWjQLFDQdis48dxA+f SxhEYeS35PXMWMB2Bsw2AaPmLLhI9YlmYp1VeMlafV07uzoBON/BVodN0NwOdmTOXKDd osb0uZy5b3IZrgwzGL2rdCYTpx1enf2nSxIiA1sqvFyHCFORewlQw3rsUNDI9lK44FqY AePA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=x7Snx1LMGQ12Pli1VMoEZcoLSddyycpkaTF8sfjPToY=; b=HQ603ucw8wjm47nLrp7rwJW9ahih5Yo9+Ey0r7PZ6IlyweWQ6f6sc6PUQ5Cz6fGY53 uCvmhR9hAkaWaP/0pMejNDS6kGL7fBvxtJ13V6I8xpfzjS3fZWivJ3Oy1tlT9eBa5td9 Fv66tS+/gTNrjT3DPwrT+FekJ3H4UpeJwPZ3SCrc5BGXvX4rlkL6GvRsWIjBEP+DIBsZ Z/RQFqF1HnYShykj2QXGdlqoobdZCNU92UitzmmH2sOwMnQM5w7IW7uM7HZ/DrGaQnAJ jeDsgT+XuykIBMIqjZk6BWOmlD8KdPYQQG+UCNy+IVJL8FuMJq/G8zesW+iXDDuZXEnw tUew== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h7si7915676pll.270.2019.06.16.08.49.26; Sun, 16 Jun 2019 08:49:41 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726470AbfFPPtW (ORCPT + 99 others); Sun, 16 Jun 2019 11:49:22 -0400 Received: from atrey.karlin.mff.cuni.cz ([195.113.26.193]:50354 "EHLO atrey.karlin.mff.cuni.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725895AbfFPPtW (ORCPT ); Sun, 16 Jun 2019 11:49:22 -0400 Received: by atrey.karlin.mff.cuni.cz (Postfix, from userid 512) id 6191F801F6; Sun, 16 Jun 2019 17:49:09 +0200 (CEST) Date: Sun, 16 Jun 2019 17:48:48 +0200 From: Pavel Machek To: Masahiro Yamada Cc: Greg KH , Arnd Bergmann , Joe Perches , Linux Media Mailing List , Mauro Carvalho Chehab , Thomas Gleixner , Randy Dunlap , Linux Kernel Mailing List Subject: Re: [PATCH] media: do not use C++ style comments in uapi headers Message-ID: <20190616154848.GA24837@xo-6d-61-c0.localdomain> References: <20190604111334.22182-1-yamada.masahiro@socionext.com> <8cf48e20064eabdfe150795365e6ca6f36032e9f.camel@perches.com> <20190604134213.GA26263@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi! > > > In fact, I detected this issue by the following patch: > > > https://patchwork.kernel.org/patch/10974669/ > > > > > > When I worked on it, I wondered which > > > c-dialect flags should be used. > > > > > > This code: > > > > > > > # Unlike the kernel space, uapi headers are written in more strict C. > > > > # - Forbid C++ style comments > > > > # - Use '__inline', '__asm__' instead of 'inline', 'asm' > > > > # > > > > # -std=c90 (equivalent to -ansi) catches the violation of those. > > > > # We cannot go as far as adding -Wpedantic since it emits too many warnings. > > > > # > > > > # REVISIT: re-consider the proper set of compiler flags for uapi compile-test. > > > > > > > > UAPI_CFLAGS := -std=c90 -Wpedantic -Wall -Werror=implicit-function-declaration > > > > > > Even "-std=c99 -Wpedantic" emits lots of warnings. > > > > > > > > > > > > I noticed one more thing. > > > > > > There are two ways to define fixed-width type. > > > > > > [1] #include , __u8, __u16, __u32, __u64 > > > > > > vs > > > > > > [2] #include , uint8_t, uint16_t, uint32_t, uint64_t > > > > > > > > > Both are used in UAPI headers. > > > IIRC, was standardized by C99. > > > > > > So, we have already relied on C99 in user-space too. > > > > Just because we have relied on it in the past, does not mean we need to > > keep relying on it. I have had numerous complaints over the years from > > libc authors that our uapi headers are _NOT_ able to be directly > > consumed by them. They all end up having to fix things up and include > > local "sanitized" copies. > > > > So any work we can do here to make them more sane and work properly > > everywhere is a good thing, as right now, they are broken. > > Maybe, we should document UAPI header coding guideline. > Without To-Don't list, > people will do anything. Even better would be a (compile-time) test that checks for problems in the headers... Pavel -- (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html