Hi,

On Thu, 22 Feb 2018, grischka wrote:

However NODATA_WANTED does more than that, for example it also suppresses
the "hello" with
        if (0) puts("hello");

Therefor I'd suggest a less radical change, such as:

@@ -6916,7 +6916,7 @@ static void decl_initializer_alloc(CType *type, AttributeDef *ad, int r,
        align = 1;
    }

-    if (NODATA_WANTED)
+    if (!v && NODATA_WANTED)
        size = 0, align = 1;

    if ((r & VT_VALMASK) == VT_LOCAL) {


Thus variable space will be allocated always but initializers are
still suppressed.  (Bypassing initializers with goto is not allowed).

For statics it is. E.g. the following program is valid and must print 42:

#include <stdio.h>
int main() {
  goto doit;
  if (0) {
    static int a = 42;
doit:
    printf ("%d\n", a);
  }
}

But the idea of supressing only nameless entities is a good one I think.


Ciao,
Michael.

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

Reply via email to