cproc

Unnamed repository; edit this file 'description' to name the repository.
git clone git://git.nihaljere.xyz/cproc
Log | Files | Refs | Submodules | README | LICENSE

commit 3f8a5efa9f94090dfc4f171858b5ed6812109289
parent ae89197f69f4cf9bd83a8ded2a6dab8aa385c71f
Author: Michael Forney <mforney@mforney.org>
Date:   Sun,  7 Jul 2019 19:08:53 -0700

type: Ignore parameter qualifiers when determining type compatibility

The end of C11 6.7.6.3p15 says that qualifiers should be ignored when
checking compatibility of function types.

Diffstat:
Mtest/compatible-function-types.c | 3+++
Mtype.c | 2--
2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/test/compatible-function-types.c b/test/compatible-function-types.c @@ -15,3 +15,6 @@ void f5(unsigned, double); void f6(const char *, ...); void f6(const char[], ...); + +void f7(const int); +void f7(int); diff --git a/type.c b/type.c @@ -155,8 +155,6 @@ typecompatible(struct type *t1, struct type *t2) return true; } for (p1 = t1->func.params, p2 = t2->func.params; p1 && p2; p1 = p1->next, p2 = p2->next) { - if (p1->qual != p2->qual) - return false; tmp = t2->func.isprototype ? p2->type : typepromote(p2->type, -1); if (!typecompatible(p1->type, tmp)) return false;