diff mbox

gdb/testsuite/compiler.c[c]: Identify clang

Message ID CAENS6EvYff12_nS5JeLZ_B2-1rirWYdosj-4PseNktGfTtbR+Q@mail.gmail.com
State Committed
Headers show

Commit Message

David Blaikie April 7, 2014, 8:39 p.m. UTC
Adding support for the testsuite to correctly identify the clang
compiler (previously it caught the generic GCC detection and was
identified as GCC 4.2).

This reduces some of the test failures when running the suite with
Clang - for example the macro tests no longer run or fail (since
they're only enabled for GCC).

    * compiler.c: identify the clang compiler

(do I need a separate ChangeLog line for compiler.cc too? should the
ChangeLog entry have the full path (gdb/testsuite/lib/compiler.c)?)

Comments

Doug Evans April 7, 2014, 8:54 p.m. UTC | #1
David Blaikie writes:
 > Adding support for the testsuite to correctly identify the clang
 > compiler (previously it caught the generic GCC detection and was
 > identified as GCC 4.2).
 > 
 > This reduces some of the test failures when running the suite with
 > Clang - for example the macro tests no longer run or fail (since
 > they're only enabled for GCC).
 > 
 >     * compiler.c: identify the clang compiler
 > 
 > (do I need a separate ChangeLog line for compiler.cc too? should the
 > ChangeLog entry have the full path (gdb/testsuite/lib/compiler.c)?)
 > diff --git gdb/testsuite/lib/compiler.c gdb/testsuite/lib/compiler.c
 > index afa0e59..c28367b 100644
 > --- gdb/testsuite/lib/compiler.c
 > +++ gdb/testsuite/lib/compiler.c
 > @@ -73,3 +73,7 @@ set need_a_set [regsub -all {\.} [join {xlc __xlc__} -] - compiler_info]
 >  #if defined (__ARMCC_VERSION)
 >  set compiler_info [join {armcc __ARMCC_VERSION} -]
 >  #endif
 > +
 > +#if defined (__clang__)
 > +set compiler_info [join {clang __clang_major__ __clang_minor__ __clang_patchlevel__} -]
 > +#endif
 > diff --git gdb/testsuite/lib/compiler.cc gdb/testsuite/lib/compiler.cc
 > index ee251bc..79c68b4 100644
 > --- gdb/testsuite/lib/compiler.cc
 > +++ gdb/testsuite/lib/compiler.cc
 > @@ -61,3 +61,7 @@ set need_a_set [regsub -all {\.} [join {xlc __xlc__} -] - compiler_info]
 >  #if defined (__ARMCC_VERSION)
 >  set compiler_info [join {armcc __ARMCC_VERSION} -]
 >  #endif
 > +
 > +#if defined (__clang__)
 > +set compiler_info [join {clang __clang_major__ __clang_minor__ __clang_patchlevel__} -]
 > +#endif

Hi.

Here's a changelog entry to use for this particular case.
The format has lots of precise rules behind it, but Monkey-See-Monkey-Do hacking should get you most if not all of the way there.

2014-04-07  David Blaikie  <dblaikie@gmail.com>

	* lib/compiler.c: Identify the clang compiler.
	* lib/compiler.cc: Ditto.

In general, all edited files need to be mentioned (though there is debate over this for some cases, wheee....), and path names are required to be relative to the directory in which the ChangeLog lives.
There is a convention for how to submit a changelog entry involving multiple ChangeLog files, but there's no need to go into that here.
David Blaikie April 7, 2014, 9:07 p.m. UTC | #2
On Mon, Apr 7, 2014 at 1:54 PM, Doug Evans <dje@google.com> wrote:
> David Blaikie writes:
>  > Adding support for the testsuite to correctly identify the clang
>  > compiler (previously it caught the generic GCC detection and was
>  > identified as GCC 4.2).
>  >
>  > This reduces some of the test failures when running the suite with
>  > Clang - for example the macro tests no longer run or fail (since
>  > they're only enabled for GCC).
>  >
>  >     * compiler.c: identify the clang compiler
>  >
>  > (do I need a separate ChangeLog line for compiler.cc too? should the
>  > ChangeLog entry have the full path (gdb/testsuite/lib/compiler.c)?)
>  > diff --git gdb/testsuite/lib/compiler.c gdb/testsuite/lib/compiler.c
>  > index afa0e59..c28367b 100644
>  > --- gdb/testsuite/lib/compiler.c
>  > +++ gdb/testsuite/lib/compiler.c
>  > @@ -73,3 +73,7 @@ set need_a_set [regsub -all {\.} [join {xlc __xlc__} -] - compiler_info]
>  >  #if defined (__ARMCC_VERSION)
>  >  set compiler_info [join {armcc __ARMCC_VERSION} -]
>  >  #endif
>  > +
>  > +#if defined (__clang__)
>  > +set compiler_info [join {clang __clang_major__ __clang_minor__ __clang_patchlevel__} -]
>  > +#endif
>  > diff --git gdb/testsuite/lib/compiler.cc gdb/testsuite/lib/compiler.cc
>  > index ee251bc..79c68b4 100644
>  > --- gdb/testsuite/lib/compiler.cc
>  > +++ gdb/testsuite/lib/compiler.cc
>  > @@ -61,3 +61,7 @@ set need_a_set [regsub -all {\.} [join {xlc __xlc__} -] - compiler_info]
>  >  #if defined (__ARMCC_VERSION)
>  >  set compiler_info [join {armcc __ARMCC_VERSION} -]
>  >  #endif
>  > +
>  > +#if defined (__clang__)
>  > +set compiler_info [join {clang __clang_major__ __clang_minor__ __clang_patchlevel__} -]
>  > +#endif
>
> Hi.
>
> Here's a changelog entry to use for this particular case.
> The format has lots of precise rules behind it, but Monkey-See-Monkey-Do hacking should get you most if not all of the way there.
>
> 2014-04-07  David Blaikie  <dblaikie@gmail.com>
>
>         * lib/compiler.c: Identify the clang compiler.
>         * lib/compiler.cc: Ditto.
>
> In general, all edited files need to be mentioned (though there is debate over this for some cases, wheee....), and path names are required to be relative to the directory in which the ChangeLog lives.
> There is a convention for how to submit a changelog entry involving multiple ChangeLog files, but there's no need to go into that here.

Thanks

Oh, and I realized I didn't actually specify, but I don't have commit
access to gdb so if the patch (and suggested ChangeLog) are acceptable
it'd be great if someone could commit it for me.

Thanks!
- David
Doug Evans April 7, 2014, 9:16 p.m. UTC | #3
On Mon, Apr 7, 2014 at 2:07 PM, David Blaikie <dblaikie@gmail.com> wrote:
> On Mon, Apr 7, 2014 at 1:54 PM, Doug Evans <dje@google.com> wrote:
>> David Blaikie writes:
>>  > Adding support for the testsuite to correctly identify the clang
>>  > compiler (previously it caught the generic GCC detection and was
>>  > identified as GCC 4.2).
>>  >
>>  > This reduces some of the test failures when running the suite with
>>  > Clang - for example the macro tests no longer run or fail (since
>>  > they're only enabled for GCC).
>>  >
>>  >     * compiler.c: identify the clang compiler
>>  >
>>  > (do I need a separate ChangeLog line for compiler.cc too? should the
>>  > ChangeLog entry have the full path (gdb/testsuite/lib/compiler.c)?)
>>  > diff --git gdb/testsuite/lib/compiler.c gdb/testsuite/lib/compiler.c
>>  > index afa0e59..c28367b 100644
>>  > --- gdb/testsuite/lib/compiler.c
>>  > +++ gdb/testsuite/lib/compiler.c
>>  > @@ -73,3 +73,7 @@ set need_a_set [regsub -all {\.} [join {xlc __xlc__} -] - compiler_info]
>>  >  #if defined (__ARMCC_VERSION)
>>  >  set compiler_info [join {armcc __ARMCC_VERSION} -]
>>  >  #endif
>>  > +
>>  > +#if defined (__clang__)
>>  > +set compiler_info [join {clang __clang_major__ __clang_minor__ __clang_patchlevel__} -]
>>  > +#endif
>>  > diff --git gdb/testsuite/lib/compiler.cc gdb/testsuite/lib/compiler.cc
>>  > index ee251bc..79c68b4 100644
>>  > --- gdb/testsuite/lib/compiler.cc
>>  > +++ gdb/testsuite/lib/compiler.cc
>>  > @@ -61,3 +61,7 @@ set need_a_set [regsub -all {\.} [join {xlc __xlc__} -] - compiler_info]
>>  >  #if defined (__ARMCC_VERSION)
>>  >  set compiler_info [join {armcc __ARMCC_VERSION} -]
>>  >  #endif
>>  > +
>>  > +#if defined (__clang__)
>>  > +set compiler_info [join {clang __clang_major__ __clang_minor__ __clang_patchlevel__} -]
>>  > +#endif
>>
>> Hi.
>>
>> Here's a changelog entry to use for this particular case.
>> The format has lots of precise rules behind it, but Monkey-See-Monkey-Do hacking should get you most if not all of the way there.
>>
>> 2014-04-07  David Blaikie  <dblaikie@gmail.com>
>>
>>         * lib/compiler.c: Identify the clang compiler.
>>         * lib/compiler.cc: Ditto.
>>
>> In general, all edited files need to be mentioned (though there is debate over this for some cases, wheee....), and path names are required to be relative to the directory in which the ChangeLog lives.
>> There is a convention for how to submit a changelog entry involving multiple ChangeLog files, but there's no need to go into that here.
>
> Thanks
>
> Oh, and I realized I didn't actually specify, but I don't have commit
> access to gdb so if the patch (and suggested ChangeLog) are acceptable
> it'd be great if someone could commit it for me.
>
> Thanks!
> - David

Done.
diff mbox

Patch

diff --git gdb/testsuite/lib/compiler.c gdb/testsuite/lib/compiler.c
index afa0e59..c28367b 100644
--- gdb/testsuite/lib/compiler.c
+++ gdb/testsuite/lib/compiler.c
@@ -73,3 +73,7 @@  set need_a_set [regsub -all {\.} [join {xlc __xlc__} -] - compiler_info]
 #if defined (__ARMCC_VERSION)
 set compiler_info [join {armcc __ARMCC_VERSION} -]
 #endif
+
+#if defined (__clang__)
+set compiler_info [join {clang __clang_major__ __clang_minor__ __clang_patchlevel__} -]
+#endif
diff --git gdb/testsuite/lib/compiler.cc gdb/testsuite/lib/compiler.cc
index ee251bc..79c68b4 100644
--- gdb/testsuite/lib/compiler.cc
+++ gdb/testsuite/lib/compiler.cc
@@ -61,3 +61,7 @@  set need_a_set [regsub -all {\.} [join {xlc __xlc__} -] - compiler_info]
 #if defined (__ARMCC_VERSION)
 set compiler_info [join {armcc __ARMCC_VERSION} -]
 #endif
+
+#if defined (__clang__)
+set compiler_info [join {clang __clang_major__ __clang_minor__ __clang_patchlevel__} -]
+#endif