[hackers] [scc] Disallow sizeof of incomplete type || Roberto E. Vargas Caballero

From: <git_AT_suckless.org>
Date: Thu, 27 Aug 2015 16:16:37 +0200 (CEST)

commit 248d4be51443e4c1a6137f285bdde1a027120bb6
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
AuthorDate: Thu Aug 27 16:07:25 2015 +0200
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
CommitDate: Thu Aug 27 16:07:25 2015 +0200

    Disallow sizeof of incomplete type

diff --git a/cc1/expr.c b/cc1/expr.c
index 107e075..233e003 100644
--- a/cc1/expr.c
+++ b/cc1/expr.c
_AT_@ -961,6 +961,8 @@ unary(void)
         case SIZEOF:
                 next();
                 tp = (yytoken == '(') ? sizeexp() : typeof(unary());
+ if (!tp->defined)
+ errorp("sizeof applied to an incomplete type");
                 return sizeofnode(tp);
         case INC:
         case DEC:
Received on Thu Aug 27 2015 - 16:16:37 CEST

This archive was generated by hypermail 2.3.0 : Thu Aug 27 2015 - 16:24:18 CEST