Re: [PATCH] media: do not use C++ style comments in uapi headers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Em Tue, 04 Jun 2019 22:22:05 -0700
Joe Perches <joe@xxxxxxxxxxx> escreveu:

> On Wed, 2019-06-05 at 07:10 +0200, Greg KH wrote:
> > On Wed, Jun 05, 2019 at 01:10:41PM +0900, Masahiro Yamada wrote:  
> > > On Wed, Jun 5, 2019 at 3:21 AM Arnd Bergmann <arnd@xxxxxxxx> wrote:  
> []
> > > This means we cannot reliably use uint{8,16,32,64}_t in UAPI headers.  
> > 
> > We should not be doing that as they are in the userspace "namespace" of
> > variables, not in the kernel namespace.  We've been over this many times
> > in the past :(  
> 
> Just not very successfully...
> 
> $ git grep -w -P 'u?_?int(?:8|16|32|64)_t' include/uapi | wc -l
> 342


> $ git grep -w -P --name-only 'u?_?int(?:8|16|32|64)_t' include/uapi | wc -l
> 13

Out of curiosity, I decided to check those occurrences...

About half of those 13 files are false-positives:

- bpf.h, pps.h and amdgpu_drm.h use those int types only inside comments;
- drm.h and coda.h have their own typedefs for those int types;
- vmwgfx_drm.h includes drm.h (which has the typedefs).

So, only 6 headers actually use posix types in a way that it seems that 
it would require including stdint.h:

- include/uapi/linux/fuse.h

  This one explicitly includes stdint.h if !__KERNEL__

- include/uapi/linux/netfilter_bridge/ebtables.h,
  include/uapi/linux/sctp.h,
  include/uapi/scsi/scsi_netlink.h and
  include/uapi/scsi/scsi_netlink_fc.h

  They include linux/types.h unconditionally, relying on
  scripts/headers_install.sh to remove it;

- include/uapi/scsi/scsi_bsg_fc.h

  It doesn't include anything. In other words, it assumes that the c file 
  would include either linux/types.h or stdint.h.

---

Not saying that this is a good idea, but, as we have already a script that
it is meant to sanitize uAPI header files when installing them
(scripts/headers_install.sh), one could modify it (or convert to perl/python)
in a way that it would be doing something like[1]:

	sed -E
		...
		-e 's,//(.*),/* \1 */,'

[1] the actual rule should be more complex than that, in order to avoid 
replacing // inside /**/ comments.

Thanks,
Mauro



[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux