[patch] Fix invalid attributes in libstdc++

Renlin Li renlin.li@arm.com
Tue Feb 3 13:49:00 GMT 2015


On 01/02/15 15:08, Jonathan Wakely wrote:
> I failed to CC gcc-patches on this patch ...
>
> On 29/01/15 13:02 +0000, Jonathan Wakely wrote:
>
> diff --git a/libstdc++-v3/testsuite/17_intro/headers/c++200x/all_attributes.cc b/libstdc++-v3/testsuite/17_intro/headers/c++200x/all_attributes.cc
> new file mode 100644
> index 0000000..c7ec27a
> --- /dev/null
> +++ b/libstdc++-v3/testsuite/17_intro/headers/c++200x/all_attributes.cc
> @@ -0,0 +1,38 @@
> +// Copyright (C) 2015 Free Software Foundation, Inc.
> +//
> +// This file is part of the GNU ISO C++ Library.  This library is free
> +// software; you can redistribute it and/or modify it under the
> +// terms of the GNU General Public License as published by the
> +// Free Software Foundation; either version 3, or (at your option)
> +// any later version.
> +
> +// This library is distributed in the hope that it will be useful,
> +// but WITHOUT ANY WARRANTY; without even the implied warranty of
> +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> +// GNU General Public License for more details.
> +
> +// You should have received a copy of the GNU General Public License along
> +// with this library; see the file COPYING3.  If not see
> +// <http://www.gnu.org/licenses/>.
> +
> +// { dg-options "-std=gnu++11" }
> +// { dg-do compile }
> +
> +// Ensure the library only uses the __name__ form for attributes.
> +// Don't test 'const' and 'noreturn' because they are reserved anyway.
> +#define abi_tag 1
> +#define always_inline 1
> +#define deprecated 1
> +#define packed 1
> +#define pure 1
> +#define unused 1
> +#define visibility 1
> +
> +#include <bits/stdc++.h> // TODO: this is missing from <bits/extc++.h>
> +#include <codecvt>       // TODO: this is missing from <bits/stdc++.h>
> +#include <bits/extc++.h>
> +
> +
>
the test case fails to build on all arm target, giving the following 
message:


src/gcc/libstdc++-v3/testsuite/17_intro/headers/c++2014/all_attributes.cc:28:16: 
error: expected ')' before numeric constant

#define unused 1
                           ^

Gcc has code using unused attribute without __name__ form. For example, 
we have the following code in gthr-default.h:
#define GLIBCXX_UNUSED __attribute_((unused))

Regards,
Renlin Li



More information about the Libstdc++ mailing list