aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoseph Myers <jsm28@cam.ac.uk>2000-07-31 07:11:39 -0600
committerJeff Law <law@gcc.gnu.org>2000-07-31 07:11:39 -0600
commitbbe65572cd946b16ba8c429ade291c1feb13b9f2 (patch)
tree454bbd6470d9978e4e5bb45bab86ab45365815a9
parentb0c4bfae2185102b22669c3ce92f5fd92a237b31 (diff)
downloadgcc-bbe65572cd946b16ba8c429ade291c1feb13b9f2.zip
gcc-bbe65572cd946b16ba8c429ade291c1feb13b9f2.tar.gz
gcc-bbe65572cd946b16ba8c429ade291c1feb13b9f2.tar.bz2
c-decl.c (get_parm_info): Don't treat 'const void'...
* c-decl.c (get_parm_info): Don't treat 'const void', 'volatile void' or 'register void' as being the special case of 'void' alone in a parameter list. From-SVN: r35377
-rw-r--r--gcc/ChangeLog4
-rw-r--r--gcc/c-decl.c10
2 files changed, 13 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index a26fc32..38d73d9 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,9 @@
2000-07-31 Joseph S. Myers <jsm28@cam.ac.uk>
+ * c-decl.c (get_parm_info): Don't treat 'const void', 'volatile
+ void' or 'register void' as being the special case of 'void' alone
+ in a parameter list.
+
* c-typeck.c (build_c_cast): Change -Wcast-qual pedwarn for
discarding qualifiers into a plain warning.
diff --git a/gcc/c-decl.c b/gcc/c-decl.c
index 5f69e36..34a8f42 100644
--- a/gcc/c-decl.c
+++ b/gcc/c-decl.c
@@ -4985,10 +4985,18 @@ get_parm_info (void_at_end)
tree new_parms = 0;
tree order = current_binding_level->parm_order;
- /* Just `void' (and no ellipsis) is special. There are really no parms. */
+ /* Just `void' (and no ellipsis) is special. There are really no parms.
+ But if the `void' is qualified (by `const' or `volatile') or has a
+ storage class specifier (`register'), then the behavior is undefined;
+ by not counting it as the special case of `void' we will cause an
+ error later. Typedefs for `void' are OK (see DR#157).
+ */
if (void_at_end && parms != 0
&& TREE_CHAIN (parms) == 0
&& VOID_TYPE_P (TREE_TYPE (parms))
+ && ! TREE_THIS_VOLATILE (parms)
+ && ! TREE_READONLY (parms)
+ && ! DECL_REGISTER (parms)
&& DECL_NAME (parms) == 0)
{
parms = NULL_TREE;