Hello,

On Tue, 1 Feb 2022, Domingo Alvarez Duarte wrote:

Hello Elijah !

On 1/2/22 6:30, Elijah Stone wrote:
 ‘cleanup’ variable attribute

It doesn't seem that tinycc has this implemented properly because testing it with this example https://echorand.me/site/notes/articles/c_cleanup/cleanup_attribute_c.html I can build and execute it but there is no output (with gcc there is the expected output).

This is deceptive! The GNU libc headers unconditionally define '__attribute__()' to nothing if the compiler isn't GCC, and not just internally, so a declaration like:

#include <stdio.h>
....

  int __attribute__((whatever!)) avar;

doesn't set any attribute at all :-/  Either do:

#undef __attribute__

after including all standard headers, or use the other form of that token:

  int __attribute((cleanup(clean_up))) avar = 1;


Ciao,
Michael.
_______________________________________________
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel

Reply via email to