This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [C,C++] integer constants in attribute arguments
- From: Andreas Schwab <schwab at suse dot de>
- To: gcc-patches at gcc dot gnu dot org
- Cc: Jason Merrill <jason at redhat dot com>
- Date: Tue, 04 Feb 2014 12:40:35 +0100
- Subject: Re: [C,C++] integer constants in attribute arguments
- Authentication-results: sourceware.org; auth=none
- References: <alpine dot DEB dot 2 dot 02 dot 1311301103070 dot 10346 at stedding dot saclay dot inria dot fr> <52C5DD73 dot 2070305 at redhat dot com> <alpine dot DEB dot 2 dot 02 dot 1401182314190 dot 23143 at stedding dot saclay dot inria dot fr>
Marc Glisse <marc.glisse@inria.fr> writes:
> Index: gcc/testsuite/g++.dg/cpp0x/constexpr-attribute2.C
> ===================================================================
> --- gcc/testsuite/g++.dg/cpp0x/constexpr-attribute2.C (revision 0)
> +++ gcc/testsuite/g++.dg/cpp0x/constexpr-attribute2.C (working copy)
> @@ -0,0 +1,32 @@
> +// { dg-options -std=gnu++11 }
> +
> +struct t { t(); };
> +
> +constexpr int prio = 123;
> +constexpr int size = 8;
> +constexpr int pos = 1;
> +enum A { zero = 0, one, two };
> +__attribute__((init_priority(prio))) t a;
> +
> +enum class E1 : int {
> + first = 101,
> + second,
> + third,
> +};
> +__attribute__((init_priority(E1::second))) t b; // Should not compile?
> +
> +enum E2 {
> + E2_first = 141,
> + E2_second,
> + E2_third,
> +};
> +__attribute__((init_priority(E2_second))) t c;
> +
> +void* my_calloc(unsigned, unsigned) __attribute__((alloc_size(pos,two)));
> +void* my_realloc(void*, unsigned) __attribute__((alloc_size(two)));
> +
> +typedef char vec __attribute__((vector_size(size)));
> +
> +void f(char*) __attribute__((nonnull(pos)));
> +
> +void g() __attribute__((aligned(size)));
/usr/local/gcc/gcc-20140204/gcc/testsuite/g++.dg/cpp0x/constexpr-attribute2.C:32:6: error: alignment for 'void g()' must be at least 16
FAIL: g++.dg/cpp0x/constexpr-attribute2.C (test for excess errors)
Andreas.
--
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."