From dadc05190da3bcef90eb7a4f3106bbce88c5d5df Mon Sep 17 00:00:00 2001 From: evans1629 Date: Sat, 30 Mar 2002 20:24:21 +0000 Subject: [PATCH] Fixed problem with comman line redefinitions (no filename). --- src/fileloc.c | 38 ++++++++++++++++++++++++++------------ test/specclauses.expect | 4 ++-- 2 files changed, 28 insertions(+), 14 deletions(-) diff --git a/src/fileloc.c b/src/fileloc.c index 5cafa56..55454b6 100644 --- a/src/fileloc.c +++ b/src/fileloc.c @@ -760,37 +760,51 @@ fileloc_unparse (fileloc f) /*@only@*/ cstring fileloc_unparseRaw (cstring fname, int lineno) { - bool parenFormat = context_getFlag (FLG_PARENFILEFORMAT); - - if (parenFormat) + if (!cstring_isEmpty (fname)) { - return (message ("%q(%d)", osd_outputPath (fname), lineno)); + bool parenFormat = context_getFlag (FLG_PARENFILEFORMAT); + + if (parenFormat) + { + return (message ("%q(%d)", osd_outputPath (fname), lineno)); + } + else + { + return (message ("%q:%d", osd_outputPath (fname), lineno)); + } } else { - return (message ("%q:%d", osd_outputPath (fname), lineno)); + return cstring_makeLiteral ("Command Line"); } } /*@only@*/ cstring fileloc_unparseRawCol (cstring fname, int lineno, int col) { - if (context_getFlag (FLG_SHOWCOL)) + if (!cstring_isEmpty (fname)) { - bool parenFormat = context_getFlag (FLG_PARENFILEFORMAT); - - if (parenFormat) + if (context_getFlag (FLG_SHOWCOL)) { - return (message ("%q(%d,%d)", osd_outputPath (fname), lineno, col)); + bool parenFormat = context_getFlag (FLG_PARENFILEFORMAT); + + if (parenFormat) + { + return (message ("%q(%d,%d)", osd_outputPath (fname), lineno, col)); + } + else + { + return (message ("%q:%d:%d", osd_outputPath (fname), lineno, col)); + } } else { - return (message ("%q:%d:%d", osd_outputPath (fname), lineno, col)); + return fileloc_unparseRaw (fname, lineno); } } else { - return fileloc_unparseRaw (fname, lineno); + return cstring_makeLiteral ("Command Line"); } } diff --git a/test/specclauses.expect b/test/specclauses.expect index 04a3972..d982d1c 100644 --- a/test/specclauses.expect +++ b/test/specclauses.expect @@ -45,8 +45,8 @@ Finished checking --- 8 code warnings, as expected specclauses3.c:7:6: Special clause accesses field of non-struct or union result (int): *(result).name specclauses3.c: (in function badResult) -specclauses3.c:12:10: Undefined storage ->name corresponds to storage - result->name listed in defines clause: NULL +specclauses3.c:12:10: Undefined storage >->name corresponds to + storage result->name listed in defines clause: NULL specclauses3.c:12:10: Null storage returned as non-null: NULL specclauses3.c: (in function createName2) specclauses3.c:29:10: Undefined storage res->name corresponds to storage -- 2.45.1