- fix include guard warning

- additional debug comments
This commit is contained in:
2017-03-06 15:39:36 +00:00
parent 16f0c0224a
commit ff6169a266

View File

@@ -236,11 +236,11 @@ STATIC int8_t createStub(char *aOutput, char *aNoSuffix, cfunction_list_t *aFunc
fprintf(cfile, " * - generated by stubser -"NEWLINES" */" NEWLINES NEWLINES); fprintf(cfile, " * - generated by stubser -"NEWLINES" */" NEWLINES NEWLINES);
fprintf(cheader, "/* @file %s"NEWLINES, gnu_basename(cHeaderName)); fprintf(cheader, "/* @file %s"NEWLINES, gnu_basename(cHeaderName));
fprintf(cheader, " * @details"NEWLINES" * This is a stub header for CUnit.\\n"NEWLINES); fprintf(cheader, " * @details"NEWLINES" * This is a stub header.\\n"NEWLINES);
fprintf(cheader, " * - generated by stubser -"NEWLINES" */" NEWLINES NEWLINES); fprintf(cheader, " * - generated by stubser -"NEWLINES" */" NEWLINES NEWLINES);
fprintf(cheader, "#ifndef _INCLUDE_%s_H"NEWLINES, aNoSuffix); fprintf(cheader, "#ifndef _STUB_%s_H"NEWLINES, aNoSuffix);
fprintf(cheader, "#define _INCLUDE_%s_H"NEWLINES NEWLINES, aNoSuffix); fprintf(cheader, "#define _STUB_%s_H"NEWLINES NEWLINES, aNoSuffix);
function = aFunctionList->head; function = aFunctionList->head;
while (function) while (function)
@@ -249,7 +249,7 @@ STATIC int8_t createStub(char *aOutput, char *aNoSuffix, cfunction_list_t *aFunc
function = function->next; function = function->next;
} }
fprintf(cheader, NEWLINES"#endif // _INCLUDE_%s_H"NEWLINES, aNoSuffix); fprintf(cheader, NEWLINES"#endif // _STUB_%s_H"NEWLINES, aNoSuffix);
free(cFileName); free(cFileName);
free(cHeaderName); free(cHeaderName);
@@ -276,10 +276,14 @@ int stubser_createStub(char *path, char* aNoSuffix, char *aOutput)
DEBUG_LOG_APPEND(1, "\n"); DEBUG_LOG_APPEND(1, "\n");
if (0 != ret) if (0 != ret)
{ {
#if isDebugLevel(1)
printf(STUB_CONSOLE_PARSE_ERROR_S2, path, ret);
#else
printf(STUB_CONSOLE_PARSE_ERROR_S2, gnu_basename(path), ret); printf(STUB_CONSOLE_PARSE_ERROR_S2, gnu_basename(path), ret);
#endif
if (-2 == ret) if (-2 == ret)
{ {
printf(" Block removal error\n"); printf(" Block removal error (likely nested comments).\n");
} }
else if (-3 == ret) else if (-3 == ret)
{ {
@@ -288,8 +292,11 @@ int stubser_createStub(char *path, char* aNoSuffix, char *aOutput)
ret = -1; ret = -1;
goto end_stubser_createStub; goto end_stubser_createStub;
} }
#if isDebugLevel(1)
printf(STUB_CONSOLE_PARSE_OK_S1, path);
#else
printf(STUB_CONSOLE_PARSE_OK_S1, gnu_basename(path)); printf(STUB_CONSOLE_PARSE_OK_S1, gnu_basename(path));
#endif
sprintf(fileName, "%s/stub_%s", aOutput, aNoSuffix); sprintf(fileName, "%s/stub_%s", aOutput, aNoSuffix);
ret = createStub(fileName, aNoSuffix, &functionList); ret = createStub(fileName, aNoSuffix, &functionList);
if (0 != ret) if (0 != ret)