From d2be4293a33ddd3dcb9beed200fea06011ae8ba7 Mon Sep 17 00:00:00 2001 From: Cary R Date: Thu, 13 May 2010 17:33:47 -0700 Subject: [PATCH] Not all compilers support struct definition inside an anonymous union The SunPro compiler does not support struct definitions inside an anonymous union. This patch moves the struct definition so that both gcc and SunPro 12.1 compile this without issue. --- vvp/symbols.cc | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/vvp/symbols.cc b/vvp/symbols.cc index 9c8896386..ce1c48d8c 100644 --- a/vvp/symbols.cc +++ b/vvp/symbols.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001-2008 Stephen Williams (steve@icarus.com) + * Copyright (c) 2001-2010 Stephen Williams (steve@icarus.com) * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU @@ -73,18 +73,19 @@ char*symbol_table_s::key_strdup_(const char*str) const unsigned leaf_width = 254; const unsigned node_width = 508; +struct tree_data_ { + char*key; + symbol_value_t val; +}; + struct tree_node_ { bool leaf_flag; unsigned count; struct tree_node_*parent; union { - struct { - char*key; - symbol_value_t val; - } leaf[leaf_width]; - - struct tree_node_*child[node_width]; + struct tree_data_ leaf[leaf_width]; + struct tree_node_ *child[node_width]; }; };