[iortcw] 268/497: All: Stop LCC from warning about null pointer conversion to function pointer

Simon McVittie smcv at debian.org
Fri Sep 8 10:37:05 UTC 2017


This is an automated email from the git hooks/post-receive script.

smcv pushed a commit to annotated tag 1.42d
in repository iortcw.

commit df4aba559c7890ae37e8a0775e43a6fdf7806c8a
Author: M4N4T4RMS at gmail.com <M4N4T4RMS at gmail.com@e65d2741-a53d-b2dc-ae96-bb75fa5e4c4a>
Date:   Wed Jan 7 09:01:28 2015 +0000

    All: Stop LCC from warning about null pointer conversion to function pointer
---
 MP/code/tools/lcc/src/c.h     | 1 +
 MP/code/tools/lcc/src/enode.c | 3 +--
 MP/code/tools/lcc/src/expr.c  | 2 +-
 SP/code/tools/lcc/src/c.h     | 1 +
 SP/code/tools/lcc/src/enode.c | 3 +--
 SP/code/tools/lcc/src/expr.c  | 2 +-
 6 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/MP/code/tools/lcc/src/c.h b/MP/code/tools/lcc/src/c.h
index 68c8f62..43bec08 100644
--- a/MP/code/tools/lcc/src/c.h
+++ b/MP/code/tools/lcc/src/c.h
@@ -577,6 +577,7 @@ extern Tree cnsttree(Type, ...);
 extern Tree consttree(unsigned int, Type);
 extern Tree eqtree(int, Tree, Tree);
 extern int iscallb(Tree);
+extern int isnullptr(Tree);
 extern Tree shtree(int, Tree, Tree);
 extern void typeerror(int, Tree, Tree);
 
diff --git a/MP/code/tools/lcc/src/enode.c b/MP/code/tools/lcc/src/enode.c
index 760096d..4a37618 100644
--- a/MP/code/tools/lcc/src/enode.c
+++ b/MP/code/tools/lcc/src/enode.c
@@ -5,7 +5,6 @@ static Tree addtree(int, Tree, Tree);
 static Tree andtree(int, Tree, Tree);
 static Tree cmptree(int, Tree, Tree);
 static int compatible(Type, Type);
-static int isnullptr(Tree e);
 static Tree multree(int, Tree, Tree);
 static Tree subtree(int, Tree, Tree);
 #define isvoidptr(ty) \
@@ -220,7 +219,7 @@ static int compatible(Type ty1, Type ty2) {
 	    && isptr(ty2) && !isfunc(ty2->type)
 	    && eqtype(unqual(ty1->type), unqual(ty2->type), 0);
 }
-static int isnullptr(Tree e) {
+int isnullptr(Tree e) {
 	Type ty = unqual(e->type);
 
 	return generic(e->op) == CNST
diff --git a/MP/code/tools/lcc/src/expr.c b/MP/code/tools/lcc/src/expr.c
index b8cb08b..96eec21 100644
--- a/MP/code/tools/lcc/src/expr.c
+++ b/MP/code/tools/lcc/src/expr.c
@@ -621,7 +621,7 @@ Tree cast(Tree p, Type type) {
 			p = simplify(CVP, dst, p, NULL);
 		else {
 			if ((isfunc(src->type) && !isfunc(dst->type))
-			|| (!isfunc(src->type) &&  isfunc(dst->type)))
+			|| (!isnullptr(p) && !isfunc(src->type) && isfunc(dst->type)))
 				warning("conversion from `%t' to `%t' is compiler dependent\n", p->type, type);
 
 			if (src->size != dst->size)
diff --git a/SP/code/tools/lcc/src/c.h b/SP/code/tools/lcc/src/c.h
index 68c8f62..43bec08 100644
--- a/SP/code/tools/lcc/src/c.h
+++ b/SP/code/tools/lcc/src/c.h
@@ -577,6 +577,7 @@ extern Tree cnsttree(Type, ...);
 extern Tree consttree(unsigned int, Type);
 extern Tree eqtree(int, Tree, Tree);
 extern int iscallb(Tree);
+extern int isnullptr(Tree);
 extern Tree shtree(int, Tree, Tree);
 extern void typeerror(int, Tree, Tree);
 
diff --git a/SP/code/tools/lcc/src/enode.c b/SP/code/tools/lcc/src/enode.c
index 760096d..4a37618 100644
--- a/SP/code/tools/lcc/src/enode.c
+++ b/SP/code/tools/lcc/src/enode.c
@@ -5,7 +5,6 @@ static Tree addtree(int, Tree, Tree);
 static Tree andtree(int, Tree, Tree);
 static Tree cmptree(int, Tree, Tree);
 static int compatible(Type, Type);
-static int isnullptr(Tree e);
 static Tree multree(int, Tree, Tree);
 static Tree subtree(int, Tree, Tree);
 #define isvoidptr(ty) \
@@ -220,7 +219,7 @@ static int compatible(Type ty1, Type ty2) {
 	    && isptr(ty2) && !isfunc(ty2->type)
 	    && eqtype(unqual(ty1->type), unqual(ty2->type), 0);
 }
-static int isnullptr(Tree e) {
+int isnullptr(Tree e) {
 	Type ty = unqual(e->type);
 
 	return generic(e->op) == CNST
diff --git a/SP/code/tools/lcc/src/expr.c b/SP/code/tools/lcc/src/expr.c
index b8cb08b..96eec21 100644
--- a/SP/code/tools/lcc/src/expr.c
+++ b/SP/code/tools/lcc/src/expr.c
@@ -621,7 +621,7 @@ Tree cast(Tree p, Type type) {
 			p = simplify(CVP, dst, p, NULL);
 		else {
 			if ((isfunc(src->type) && !isfunc(dst->type))
-			|| (!isfunc(src->type) &&  isfunc(dst->type)))
+			|| (!isnullptr(p) && !isfunc(src->type) && isfunc(dst->type)))
 				warning("conversion from `%t' to `%t' is compiler dependent\n", p->type, type);
 
 			if (src->size != dst->size)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/iortcw.git



More information about the Pkg-games-commits mailing list