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=-0.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,HTML_MESSAGE,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no 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 4FC27C1B0D9 for ; Mon, 7 Dec 2020 08:57:50 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0821F23108 for ; Mon, 7 Dec 2020 08:57:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0821F23108 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=lagfreegames.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A637D6E7D4; Mon, 7 Dec 2020 08:56:57 +0000 (UTC) Received: from mail-vs1-xe42.google.com (mail-vs1-xe42.google.com [IPv6:2607:f8b0:4864:20::e42]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1771A6E138 for ; Fri, 4 Dec 2020 10:09:14 +0000 (UTC) Received: by mail-vs1-xe42.google.com with SMTP id x26so2958876vsq.1 for ; Fri, 04 Dec 2020 02:09:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lagfreegames.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=CjgiGPtp7rrNRYAzI1DnO4zsvAGzYxQzoeoz02OGn+w=; b=BvybJ3+Yvp0OnG/9CwuviI87kRnQV1MfamE5B+RH8pARE7JRLekwbDtqEHocK1+bAB G5IzzlhsSYrslBPGfC96h6tDQCfUo6V12EJx9GsqrR0U+n/UvdWHJ1MGyJWT4UAGTeqG 3H7p5/kAXwBFlvytF3cF/uOJdC2UQZvCrLXCtXjuYTyNAfRffB89n+1LdhTVbSCLgcwA Ndjhm8t2Nsk24EzrW+jMy5xeZqyWKZ6wyKCW5Z4bfZTgMB3Cp08ug3W3X6Yg6BDoIjL+ FPWMX/YMD7SWOju9jPeYeE309GhADZl0xTNVdc2HzpYW/ljT2UW8IDuzvkFfw4zY2mGl WpbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=CjgiGPtp7rrNRYAzI1DnO4zsvAGzYxQzoeoz02OGn+w=; b=PiuU8n5Ut+mXy9KZN6XpxjXvuu6d+3fv/czfNZFxpfptVKl+2WN8gUcJh0sx4MqbMY KDDXALjopVrvBU8jkwzhpvrTPGqeCBY8uwDez7fsGolVlKIwSH47KqnT4G08xVDZj40H b6arC37usuKi5SybPFn/zDxGNDdQ20yCCTe2Tlc/kO/oFPKDV53LDmOuDHif1q2r2Jpn PD357KYJHx3djHXmGLeN2MmKv08cd472hHOrnSfTwkEZY17jQQZykABW6wuwevcciJVm 7NKC1DOTsZ8Uc7/TN2IdwI/jBKhHunYytermkJwuAEP9TOa0Rpgvpzb/nAHFkyFFA7ab GDMg== X-Gm-Message-State: AOAM532J9tLcvmqKuNfYEA5pWlVm6X5CPQLBZ4jsJam/vKtfdMeRuS9P oEHqPjgfnM31LoRTQLe8BCyqZR0q9lajCYwLHPyJgw== X-Google-Smtp-Source: ABdhPJxETeRM2ihYgYs+VqcMy0CcxsRfBy15uWSHdBh/N67v7tLGu0+T22OZ+o5BBaiti9W4HKnBtyCmOQ4UYzxDOf0= X-Received: by 2002:a67:7902:: with SMTP id u2mr2168763vsc.41.1607076553211; Fri, 04 Dec 2020 02:09:13 -0800 (PST) MIME-Version: 1.0 References: <1607057617-145-1-git-send-email-jpark37@lagfreegames.com> <1607057617-145-2-git-send-email-jpark37@lagfreegames.com> In-Reply-To: From: James Park Date: Fri, 4 Dec 2020 02:08:24 -0800 Message-ID: Subject: Re: [PATCH] drm: Allow drm_fourcc.h without including drm.h To: Simon Ser X-Mailman-Approved-At: Mon, 07 Dec 2020 08:56:49 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "dri-devel@lists.freedesktop.org" , James Park Content-Type: multipart/mixed; boundary="===============1761229225==" Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" --===============1761229225== Content-Type: multipart/alternative; boundary="00000000000014cbd105b5a0ab8e" --00000000000014cbd105b5a0ab8e Content-Type: text/plain; charset="UTF-8" I suppose I should do this to avoid fighting with #ifdef DRM_FOURCC_STANDALONE #if defined(__linux__) #include #else #include 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 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 wrote: > >> On Friday, December 4, 2020 5:53 AM, James Park >> wrote: >> >> > +#ifdef DRM_FOURCC_STANDALONE >> > +#include >> > >> > +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. >> > --00000000000014cbd105b5a0ab8e Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
I suppose I should do this to avoid fighting with <linu= x/types.h>

#ifdef DRM_FOURCC_STANDALONE
#if define= d(__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_STANDALON= E is enabled with whatever LInux declared __u32/__u64 as, but I think the i= mplication is that once DRM_FOURCC_STANDALONE has been declared, that's= kind of a promise not to include drm.h.

I'm fin= e with=C2=A0this, but I'm not married to it if someone has a problem wh= ere they want to define DRM_FOURCC_STANDALONE, but also can't avoid inc= luding drm.h for some reason.

On Fri, Dec 4, 2020 at 12:53 AM Simon Se= r <contact@emer= sion.fr> wrote:
On Friday, December 4, 2020 5:53 AM, James Park <jpark37@lagfreegames.com&= gt; 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.
--00000000000014cbd105b5a0ab8e-- --===============1761229225== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel --===============1761229225==--