diff mbox

hsakmt: allow building with gcc 4.x

Message ID DM3PR12MB0905C50894D0B6E45C9D2F11E8870@DM3PR12MB0905.namprd12.prod.outlook.com (mailing list archive)
State New, archived
Headers show

Commit Message

Bridgman, John March 29, 2016, 3:39 p.m. UTC
The hsakmt code requires c99 support, however gcc 4.x defaults to
c89 while gcc 5 defaults to c11. Adding this macro provides c99
support on older gcc while not forcing gcc 5 back from c11 to c99.

Signed-off-by: John Bridgman <john.bridgman@amd.com>
---
 configure.ac | 1 +
 1 file changed, 1 insertion(+)

Comments

Emil Velikov March 29, 2016, 8:08 p.m. UTC | #1
Hi John,

On 29 March 2016 at 16:39, Bridgman, John <John.Bridgman@amd.com> wrote:
> The hsakmt code requires c99 support, however gcc 4.x defaults to
> c89 while gcc 5 defaults to c11. Adding this macro provides c99
> support on older gcc while not forcing gcc 5 back from c11 to c99.
>
> Signed-off-by: John Bridgman <john.bridgman@amd.com>
> ---
>  configure.ac | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/configure.ac b/configure.ac
> index b8e9bea..8f32cbb 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -66,6 +66,7 @@ AC_CANONICAL_HOST
>  AC_PROG_AWK
>  test_CFLAGS=${CFLAGS+set} # We may override autoconf default CFLAGS.
>  AC_PROG_CC
> +AC_PROG_CC_STDC
Some versions of autoconf have AC_PROG_CC_STDC as obsolete, while
others will silently fall back to C89 (according to the autoconf ML).

I've used AC_PROG_CC_C99 and $ac_cv_prog_cc_c99 for libdrm [1]. Did
not have old enough compiler to test it against though :-\

-Emil

[1] https://cgit.freedesktop.org/mesa/drm/commit/?id=e59f00fb43c2b83bdadb17fa35c3018f817a3806
Bridgman, John March 29, 2016, 10:13 p.m. UTC | #2
>-----Original Message-----

>From: Emil Velikov [mailto:emil.l.velikov@gmail.com]

>Sent: Tuesday, March 29, 2016 4:08 PM

>To: Bridgman, John

>Cc: dri-devel@lists.freedesktop.org

>Subject: Re: [PATCH] hsakmt: allow building with gcc 4.x

>

>Hi John,

>

>On 29 March 2016 at 16:39, Bridgman, John <John.Bridgman@amd.com>

>wrote:

>> The hsakmt code requires c99 support, however gcc 4.x defaults to

>> c89 while gcc 5 defaults to c11. Adding this macro provides c99

>> support on older gcc while not forcing gcc 5 back from c11 to c99.

>>

>> Signed-off-by: John Bridgman <john.bridgman@amd.com>

>> ---

>>  configure.ac | 1 +

>>  1 file changed, 1 insertion(+)

>>

>> diff --git a/configure.ac b/configure.ac index b8e9bea..8f32cbb 100644

>> --- a/configure.ac

>> +++ b/configure.ac

>> @@ -66,6 +66,7 @@ AC_CANONICAL_HOST

>>  AC_PROG_AWK

>>  test_CFLAGS=${CFLAGS+set} # We may override autoconf default CFLAGS.

>>  AC_PROG_CC

>> +AC_PROG_CC_STDC

>Some versions of autoconf have AC_PROG_CC_STDC as obsolete, while

>others will silently fall back to C89 (according to the autoconf ML).

>

>I've used AC_PROG_CC_C99 and $ac_cv_prog_cc_c99 for libdrm [1]. Did not

>have old enough compiler to test it against though :-\


Hi Emil,

I looked at both AC_PROG_CC_STDC and _C99 options, but found more anecdotal concerns about _C99 so went with _STDC for the patch... but after sending it out I realized that the concerns I found seemed to apply to both STDC and C99 equally. I read about _STDC being obsoleted but also noticed that it was "unobsoleted" in autoconf 2.60, the same release where AC_PROG_CC_C99 was apparently added.

I did run across a 2013 email suggesting that _C99 and _STDC were *both* going to be obsoleted, but was not able to find any further discussion and did not see any mention of either macro in subsequent autoconf release notes. 

Anyways, if you are using AC_PROG_CC_C99 in libdrm then I think it makes sense to do the same in libhsakmt. I will spin a v2 of the patch.

Thanks,
John
>

>-Emil

>

>[1]

>https://cgit.freedesktop.org/mesa/drm/commit/?id=e59f00fb43c2b83bdadb1

>7fa35c3018f817a3806
diff mbox

Patch

diff --git a/configure.ac b/configure.ac
index b8e9bea..8f32cbb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -66,6 +66,7 @@  AC_CANONICAL_HOST
 AC_PROG_AWK
 test_CFLAGS=${CFLAGS+set} # We may override autoconf default CFLAGS.
 AC_PROG_CC
+AC_PROG_CC_STDC
 AC_PROG_INSTALL
 AC_PROG_LIBTOOL
 AC_PROG_MAKE_SET