This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 1/2] Add a STATIC_ASSERT on sizeof (struct cp_token)


On Mi, Jul 27 2016, David Malcolm <dmalcolm@redhat.com> wrote:

> +/* The C++ frontend lexes everything first, and keeps the tokens
> +   in memory, so there are possibly millions of tokens in memory.
> +
> +   Use a STATIC_ASSERT to ensure that we don't accidentally grow
> +   the structure.
> +
> +   To avoid introducing too many assumptions on the host data layout,
> +   only enable the assertion when compiling with GCC for a
> +   known-good host.  */
> +#if defined (__GNUC__) && defined (__x86_64__)
> +STATIC_ASSERT (sizeof (cp_token) ==

If you make that <= then you can enable it on more hosts.

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."


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]