Message ID | 1607057617-145-2-git-send-email-jpark37@lagfreegames.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | drm: Allow drm_fourcc.h without including drm.h | expand |
On Friday, December 4, 2020 5:53 AM, James Park <jpark37@lagfreegames.com> wrote: > +#ifdef DRM_FOURCC_STANDALONE > +#include <stdint.h> > > +typedef uint32_t __u32; > +typedef uint64_t __u64; > +#else > #include "drm.h" > +#endif C11 allows duplicate typedefs, but older versions of the standard don't AFAIK. If this is a concern, a solution would be to guard the typedefs.
The typedefs might also conflict on Linux if DRM_FOURCC_STANDALONE is enabled with whatever LInux declared __u32/__u64 as, but I think the implication is that once DRM_FOURCC_STANDALONE has been declared, that's kind of a promise not to include drm.h. I'm fine with this, but I'm not married to it if someone has a problem where they want to define DRM_FOURCC_STANDALONE, but also can't avoid including drm.h for some reason. On Fri, Dec 4, 2020 at 12:53 AM Simon Ser <contact@emersion.fr> wrote: > On Friday, December 4, 2020 5:53 AM, James Park <jpark37@lagfreegames.com> > wrote: > > > +#ifdef DRM_FOURCC_STANDALONE > > +#include <stdint.h> > > > > +typedef uint32_t __u32; > > +typedef uint64_t __u64; > > +#else > > #include "drm.h" > > +#endif > > C11 allows duplicate typedefs, but older versions of the standard > don't AFAIK. If this is a concern, a solution would be to guard the > typedefs. >
I suppose I should do this to avoid fighting with <linux/types.h> #ifdef DRM_FOURCC_STANDALONE #if defined(__linux__) #include <linux/types.h> #else #include <stdint.h> typedef uint32_t __u32; typedef uint64_t __u64; #endif #else #include "drm.h" #endif I'll wait for more feedback before updating the patch though. On Fri, Dec 4, 2020 at 1:47 AM James Park <james.park@lagfreegames.com> wrote: > The typedefs might also conflict on Linux if DRM_FOURCC_STANDALONE is > enabled with whatever LInux declared __u32/__u64 as, but I think the > implication is that once DRM_FOURCC_STANDALONE has been declared, that's > kind of a promise not to include drm.h. > > I'm fine with this, but I'm not married to it if someone has a problem > where they want to define DRM_FOURCC_STANDALONE, but also can't avoid > including drm.h for some reason. > > On Fri, Dec 4, 2020 at 12:53 AM Simon Ser <contact@emersion.fr> wrote: > >> On Friday, December 4, 2020 5:53 AM, James Park <jpark37@lagfreegames.com> >> wrote: >> >> > +#ifdef DRM_FOURCC_STANDALONE >> > +#include <stdint.h> >> > >> > +typedef uint32_t __u32; >> > +typedef uint64_t __u64; >> > +#else >> > #include "drm.h" >> > +#endif >> >> C11 allows duplicate typedefs, but older versions of the standard >> don't AFAIK. If this is a concern, a solution would be to guard the >> typedefs. >> >
Hi James,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on drm-intel/for-linux-next]
[also build test WARNING on drm-exynos/exynos-drm-next tegra-drm/drm/tegra/for-next drm-tip/drm-tip linus/master drm/drm-next v5.10-rc6 next-20201204]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/James-Park/drm-Allow-drm_fourcc-h-without-including-drm-h/20201204-163753
base: git://anongit.freedesktop.org/drm-intel for-linux-next
config: x86_64-randconfig-c002-20201204 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce (this is a W=1 build):
# https://github.com/0day-ci/linux/commit/444ac999e27a36307f741eb0ef60d630b0b8946a
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review James-Park/drm-Allow-drm_fourcc-h-without-including-drm-h/20201204-163753
git checkout 444ac999e27a36307f741eb0ef60d630b0b8946a
# save the attached .config to linux build tree
make W=1 ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
>> usr/include/drm/drm_fourcc.h:29: found __[us]{8,16,32,64} type without #include <linux/types.h>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Hi James,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on drm-intel/for-linux-next]
[also build test WARNING on drm-exynos/exynos-drm-next tegra-drm/drm/tegra/for-next drm-tip/drm-tip linus/master v5.10-rc6 next-20201204]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/James-Park/drm-Allow-drm_fourcc-h-without-including-drm-h/20201204-163753
base: git://anongit.freedesktop.org/drm-intel for-linux-next
config: x86_64-randconfig-a014-20201204 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 32c501dd88b62787d3a5ffda7aabcf4650dbe3cd)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install x86_64 cross compiling tool for clang build
# apt-get install binutils-x86-64-linux-gnu
# https://github.com/0day-ci/linux/commit/444ac999e27a36307f741eb0ef60d630b0b8946a
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review James-Park/drm-Allow-drm_fourcc-h-without-including-drm-h/20201204-163753
git checkout 444ac999e27a36307f741eb0ef60d630b0b8946a
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
>> usr/include/drm/drm_fourcc.h:29: found __[us]{8,16,32,64} type without #include <linux/types.h>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
diff --git a/include/uapi/drm/drm_fourcc.h b/include/uapi/drm/drm_fourcc.h index 82f3278..159a9d0 100644 --- a/include/uapi/drm/drm_fourcc.h +++ b/include/uapi/drm/drm_fourcc.h @@ -24,7 +24,13 @@ #ifndef DRM_FOURCC_H #define DRM_FOURCC_H +#ifdef DRM_FOURCC_STANDALONE +#include <stdint.h> +typedef uint32_t __u32; +typedef uint64_t __u64; +#else #include "drm.h" +#endif #if defined(__cplusplus) extern "C" {
Add DRM_FOURCC_STANDALONE guard to skip drm.h dependency. This will allow Mesa to port code to Windows more easily. Signed-off-by: James Park <jpark37@lagfreegames.com> --- include/uapi/drm/drm_fourcc.h | 6 ++++++ 1 file changed, 6 insertions(+)