From ab51c0994672eadb458571b3f6183a0ae0a166ac Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Tue, 18 Feb 2014 20:06:50 +0000 Subject: [PATCH] [SPEC2DEF] Don't make exports by ordinal NONAME automatically. Fixes a bunch of tests. Thanks to Amine for finding the problem in the first place. svn path=/trunk/; revision=62250 --- reactos/tools/spec2def/spec2def.c | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/reactos/tools/spec2def/spec2def.c b/reactos/tools/spec2def/spec2def.c index ce8ac0be83f..018b72fe424 100644 --- a/reactos/tools/spec2def/spec2def.c +++ b/reactos/tools/spec2def/spec2def.c @@ -51,6 +51,7 @@ enum FL_PRIVATE = 1, FL_STUB = 2, FL_NONAME = 4, + FL_ORDINAL = 8, }; enum @@ -476,7 +477,7 @@ OutputLine_def(FILE *fileDest, EXPORT *pexp) else OutputLine_def_GCC(fileDest, pexp); - if (pexp->nOrdinal != -1) + if (pexp->uFlags & FL_ORDINAL) { fprintf(fileDest, " @%d", pexp->nOrdinal); } @@ -541,8 +542,13 @@ ParseFile(char* pcStart, FILE *fileDest, PFNOUTLINE OutputLine) // nLine, TokenLength(pc), pc); /* Now we should get either an ordinal or @ */ - if (*pc == '@') exp.nOrdinal = -1; - else exp.nOrdinal = atol(pc); + if (*pc == '@') + exp.nOrdinal = -1; + else + { + exp.nOrdinal = atol(pc); + exp.uFlags |= FL_ORDINAL; + } /* Go to next token (type) */ if (!(pc = NextToken(pc))) @@ -627,10 +633,13 @@ ParseFile(char* pcStart, FILE *fileDest, PFNOUTLINE OutputLine) { exp.uFlags |= FL_PRIVATE; } - else if (CompareToken(pc, "-noname") || - CompareToken(pc, "-ordinal")) + else if (CompareToken(pc, "-noname")) { - exp.uFlags |= FL_NONAME; + exp.uFlags |= FL_ORDINAL | FL_NONAME; + } + else if (CompareToken(pc, "-ordinal")) + { + exp.uFlags |= FL_ORDINAL; } else if (CompareToken(pc, "-stub")) { @@ -667,7 +676,7 @@ ParseFile(char* pcStart, FILE *fileDest, PFNOUTLINE OutputLine) sprintf(namebuffer, "ordinal%d", exp.nOrdinal); exp.strName.len = strlen(namebuffer); exp.strName.buf = namebuffer; - exp.uFlags |= FL_NONAME; + exp.uFlags |= FL_ORDINAL | FL_NONAME; } /* Handle parameters */ @@ -804,9 +813,10 @@ ParseFile(char* pcStart, FILE *fileDest, PFNOUTLINE OutputLine) } /* Check for no-name without ordinal */ - if ((exp.uFlags & FL_NONAME) && (exp.nOrdinal == -1)) + if ((exp.uFlags & FL_ORDINAL) && (exp.nOrdinal == -1)) { - fprintf(stderr, "error: line %d, noname export without ordinal!\n", nLine); + fprintf(stderr, "error: line %d, ordinal export without ordinal!\n", nLine); + return -1; } OutputLine(fileDest, &exp); -- 2.17.1