[PATCH XTS 1/2] mc: Add the ability to pass literal NULL arguments to XCALL functions

Aaron Plattner aplattner at nvidia.com
Tue Apr 12 17:28:50 PDT 2011


Check for "NULL" in the argument list at the top of the .m file.  If
found, skip creating a declaration or initializer for it but do
include it in the argument list when emitting the code for XCALL.

Signed-off-by: Aaron Plattner <aplattner at nvidia.com>
---
 xts5/src/bin/mc/code.c |    8 ++++++++
 xts5/src/bin/mc/mc.h   |    1 +
 2 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/xts5/src/bin/mc/code.c b/xts5/src/bin/mc/code.c
index 9c483fb..b6036c3 100644
--- a/xts5/src/bin/mc/code.c
+++ b/xts5/src/bin/mc/code.c
@@ -438,6 +438,10 @@ static	int 	oncethrough;
 		fprintf(FpExtern, "/*\n * Arguments to the %s %s\n */\n",
 			State.name, (mflag)? "macro": "function");
 	for (i = 2; i < Nargs; i++) {
+		/* Don't emit a declaration for literal NULL arguments */
+		if (!strcmp(Argnames[i], NULLSYM))
+		    continue;
+
 		fprintf(FpExtern, "static ");
 		for (cp = Arglines[i]; *cp; cp++) {
 			if ((*cp == ' ' && cp[1] == '=') || *cp == '=') {
@@ -462,6 +466,10 @@ static	int 	oncethrough;
 		fprintf(FpCode, "static void\nsetargs()\n{\n");
 
 		for (i = 2; i < Nargs; i++) {
+			/* Don't emit an initializer for literal NULL arguments */
+			if (!strcmp(Argnames[i], NULLSYM))
+			    continue;
+
 			if (Arginit[i])
 				fprintf(FpCode, "\t%s = %s", Argnames[i], Arginit[i]);
 			else
diff --git a/xts5/src/bin/mc/mc.h b/xts5/src/bin/mc/mc.h
index 487fed4..13d0ac2 100644
--- a/xts5/src/bin/mc/mc.h
+++ b/xts5/src/bin/mc/mc.h
@@ -130,6 +130,7 @@ purpose.  It is provided "as is" without express or implied warranty.
 
 #define XCALLSYM	"XCALL"
 #define XNAMESYM	"xname"
+#define NULLSYM		"NULL"
 
 #define	ASLENGTH	60
 
-- 
1.7.1



More information about the xorg-devel mailing list