From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 554EFC282CE for ; Tue, 4 Jun 2019 15:28:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E4B53218EA for ; Tue, 4 Jun 2019 15:28:31 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=nifty.com header.i=@nifty.com header.b="gkcG3kL/" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728063AbfFDP2b (ORCPT ); Tue, 4 Jun 2019 11:28:31 -0400 Received: from conssluserg-02.nifty.com ([210.131.2.81]:45953 "EHLO conssluserg-02.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727843AbfFDP2a (ORCPT ); Tue, 4 Jun 2019 11:28:30 -0400 Received: from mail-ua1-f50.google.com (mail-ua1-f50.google.com [209.85.222.50]) (authenticated) by conssluserg-02.nifty.com with ESMTP id x54FSN4H002555; Wed, 5 Jun 2019 00:28:24 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-02.nifty.com x54FSN4H002555 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1559662104; bh=xVd2/15cRIYRvqEFrZt+GrU5RKlOB2iz/49zmh4Olfg=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=gkcG3kL/oS6oTDjulpc8HBbEQb4OwyqoBfF+sF2fstjpOkFhHsRLBLsslDXG27N+F UKcqGCZu9O5jpNbD4f/S3WyMo+iRRbU/Cn9B+VhyrW3i7pHC+IOUwIHxTmCPG4yHUr 68qyS48qeeWln9LIg7OboNpqpU8f3YO1bTTbmIbhwVb6z12V2e/KIVL62qYQPWTwzy gfXTq+hWZPP2e4UL2MCV0FGJyKewejyKJKreelnfu/E1KuqPvB4PhMR2fx/14YEurV iLvgcd3RlDoJHiW3hMfgXsUA64rnImhgn3q1IdZwzVHsu3bUWmLq4ZiylpH+k0nkFc BQOuzIuIHO3Lg== X-Nifty-SrcIP: [209.85.222.50] Received: by mail-ua1-f50.google.com with SMTP id 7so7959291uah.1; Tue, 04 Jun 2019 08:28:24 -0700 (PDT) X-Gm-Message-State: APjAAAW8TRRAbB4SrZ6gjnjWZXCQ2ysTyd+/Vx6M8qqtoUlzFVeUUlI/ gL69GHW0Folp1xj8/pzYFm0XbaKu/kzZQfnyPfw= X-Google-Smtp-Source: APXvYqz+9e5VCPBgmEDoWY6szosjZ6mKOCPexT7e/JjcmIzEzwsBPsiBfx089e0PnpelIZP4GrceIIo180eeV+mF/kk= X-Received: by 2002:a9f:24a3:: with SMTP id 32mr14726733uar.109.1559662103076; Tue, 04 Jun 2019 08:28:23 -0700 (PDT) MIME-Version: 1.0 References: <20190604111334.22182-1-yamada.masahiro@socionext.com> <8cf48e20064eabdfe150795365e6ca6f36032e9f.camel@perches.com> <20190604134213.GA26263@kroah.com> In-Reply-To: <20190604134213.GA26263@kroah.com> From: Masahiro Yamada Date: Wed, 5 Jun 2019 00:27:47 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] media: do not use C++ style comments in uapi headers To: Greg KH Cc: Arnd Bergmann , Joe Perches , Linux Media Mailing List , Mauro Carvalho Chehab , Thomas Gleixner , Randy Dunlap , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 4, 2019 at 10:44 PM Greg KH wrote: > > On Tue, Jun 04, 2019 at 09:48:12PM +0900, Masahiro Yamada wrote: > > On Tue, Jun 4, 2019 at 8:55 PM Arnd Bergmann wrote: > > > > > > On Tue, Jun 4, 2019 at 1:23 PM Joe Perches wrote: > > > > > > > > On Tue, 2019-06-04 at 20:13 +0900, Masahiro Yamada wrote: > > > > > On the other hand, uapi headers are written in more strict C, where > > > > > the C++ comment style is forbidden. > > > > > > > > Is this a real problem for any toolchain? > > > > > > There is likely some code that is built with -Wpedandic -Werror --std=c89 > > > or similar. Since glibc allows this combination for its own headers, it seems > > > best to also allow it in kernel headers that may be included by libc headers > > > or by applications, at least where it does not hurt. > > > > > > Realistically though, we probably assume c99 or gnu89 in user space > > > headers anyway, since there is no 'long long' in earlier standards. > > > > > > Arnd > > > > 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. -- Best Regards Masahiro Yamada