[Mingw-users] Trouble with alloca.h

Back to archive index
Keith Marshall keith****@users*****
Tue Feb 19 06:06:42 JST 2019


On 18/02/19 03:31, Eli Zaretskii wrote:
>> it should simply, and unilaterally, override the endemic
>> brain damage in packages such as Gnulib, and just #undef any 
>> pre-existing, conflicting macro definition.
>
> That should also work, but it might mean part of the offending package
> is compiled with "the other" definition of alloca, which could cause
> some subtle problem?

That should make no difference whatsoever; in either case the same
compiler intrinsic should be expanded in-line, yielding identically the
same object code for both.  The problem with the pre-emptive definition
of alloca as a macro:

  #define alloca __builtin_alloca

means the the subsequent in-line function definition would become:

  __CRT_ALIAS void *__builtin_alloca( size_t __n )
  { return __builtin_alloc( __n ); }

which, if it were allowed, would recurse ad-infinitum, at the point of
expansion.  Of course, it isn't allowed, because recursive functions are
not capable of in-line expansion, and __builtin_alloca() *must* be so
expanded.  Even if this disallowed expansion weren't sufficient to
prevent successful compilation, it is also questionable whether the
redefinition of the compiler intrinsic would be permitted.

-- 
Regards,
Keith.

Public key available from keys.gnupg.net
Key fingerprint: C19E C018 1547 DE50 E1D4 8F53 C0AD 36C6 347E 5A3F

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: OpenPGP digital signature
URL: <https://lists.osdn.me/mailman/archives/mingw-users/attachments/20190218/fbe06257/attachment.sig>


More information about the MinGW-Users mailing list
Back to archive index