diff --git a/change_notes/2023-04-28-a14-7-2.md b/change_notes/2023-04-28-a14-7-2.md new file mode 100644 index 0000000000..b74b95449f --- /dev/null +++ b/change_notes/2023-04-28-a14-7-2.md @@ -0,0 +1 @@ + * `A14-7-2` - alert messages have been slightly adjusted to refer only to the base name of a file, not the full relative path. \ No newline at end of file diff --git a/cpp/autosar/src/rules/A14-7-2/TemplateSpecializationNotDeclaredInTheSameFile.ql b/cpp/autosar/src/rules/A14-7-2/TemplateSpecializationNotDeclaredInTheSameFile.ql index b583c9cc14..94214e8992 100644 --- a/cpp/autosar/src/rules/A14-7-2/TemplateSpecializationNotDeclaredInTheSameFile.ql +++ b/cpp/autosar/src/rules/A14-7-2/TemplateSpecializationNotDeclaredInTheSameFile.ql @@ -58,4 +58,4 @@ where not spec.getFile() = spec.getPrimary().getFile() and not extraExclude(spec) select spec, "Specialization found in file $@ where primary template is outside that file.", - spec.getFile(), spec.getFile().getRelativePath() + spec.getFile(), spec.getFile().getBaseName() diff --git a/cpp/autosar/test/rules/A14-7-2/TemplateSpecializationNotDeclaredInTheSameFile.expected b/cpp/autosar/test/rules/A14-7-2/TemplateSpecializationNotDeclaredInTheSameFile.expected index 1ec607ca49..e697056580 100644 --- a/cpp/autosar/test/rules/A14-7-2/TemplateSpecializationNotDeclaredInTheSameFile.expected +++ b/cpp/autosar/test/rules/A14-7-2/TemplateSpecializationNotDeclaredInTheSameFile.expected @@ -1,3 +1,3 @@ -| test.cpp:5:20:5:25 | s | Specialization found in file $@ where primary template is outside that file. | test.cpp:0:0:0:0 | test.cpp | rules/A14-7-2/test.cpp | -| test.cpp:7:18:7:24 | f | Specialization found in file $@ where primary template is outside that file. | test.cpp:0:0:0:0 | test.cpp | rules/A14-7-2/test.cpp | -| test.cpp:13:19:13:28 | vector> | Specialization found in file $@ where primary template is outside that file. | test.cpp:0:0:0:0 | test.cpp | rules/A14-7-2/test.cpp | +| test.cpp:5:20:5:25 | s | Specialization found in file $@ where primary template is outside that file. | test.cpp:0:0:0:0 | test.cpp | test.cpp | +| test.cpp:7:18:7:24 | f | Specialization found in file $@ where primary template is outside that file. | test.cpp:0:0:0:0 | test.cpp | test.cpp | +| test.cpp:13:19:13:28 | vector> | Specialization found in file $@ where primary template is outside that file. | test.cpp:0:0:0:0 | test.cpp | test.cpp | diff --git a/cpp/autosar/test/rules/A15-1-5/ExceptionsThrownAcrossExecutionBoundaries.expected.clang b/cpp/autosar/test/rules/A15-1-5/ExceptionsThrownAcrossExecutionBoundaries.expected.clang new file mode 100644 index 0000000000..e69de29bb2 diff --git a/cpp/autosar/test/rules/A15-1-5/ExceptionsThrownAcrossExecutionBoundaries.expected.gcc b/cpp/autosar/test/rules/A15-1-5/ExceptionsThrownAcrossExecutionBoundaries.expected.gcc new file mode 100644 index 0000000000..e69de29bb2 diff --git a/cpp/autosar/test/rules/A15-1-5/ExceptionsThrownAcrossExecutionBoundaries.expected.qcc b/cpp/autosar/test/rules/A15-1-5/ExceptionsThrownAcrossExecutionBoundaries.expected.qcc new file mode 100644 index 0000000000..e69de29bb2 diff --git a/cpp/autosar/test/rules/A18-0-3/LocaleFunctionsUsed.expected b/cpp/autosar/test/rules/A18-0-3/LocaleFunctionsUsed.expected index f6bfa5f4d9..1521b1a9f4 100644 --- a/cpp/autosar/test/rules/A18-0-3/LocaleFunctionsUsed.expected +++ b/cpp/autosar/test/rules/A18-0-3/LocaleFunctionsUsed.expected @@ -1,10 +1,10 @@ -| test.cpp:4:3:4:16 | call to setlocale | Use of function 'std::setlocale'. | -| test.cpp:5:3:5:16 | call to setlocale | Use of function 'std::setlocale'. | -| test.cpp:6:3:6:16 | call to setlocale | Use of function 'std::setlocale'. | -| test.cpp:7:3:7:16 | call to setlocale | Use of function 'std::setlocale'. | -| test.cpp:8:3:8:16 | call to setlocale | Use of function 'std::setlocale'. | -| test.cpp:9:3:9:16 | call to setlocale | Use of function 'std::setlocale'. | -| test.cpp:10:20:10:34 | call to localeconv | Use of function 'std::localeconv'. | +| test.cpp:4:3:4:16 | call to setlocale | Use of function 'setlocale'. | +| test.cpp:5:3:5:16 | call to setlocale | Use of function 'setlocale'. | +| test.cpp:6:3:6:16 | call to setlocale | Use of function 'setlocale'. | +| test.cpp:7:3:7:16 | call to setlocale | Use of function 'setlocale'. | +| test.cpp:8:3:8:16 | call to setlocale | Use of function 'setlocale'. | +| test.cpp:9:3:9:16 | call to setlocale | Use of function 'setlocale'. | +| test.cpp:10:20:10:34 | call to localeconv | Use of function 'localeconv'. | | test.cpp:12:3:12:11 | call to setlocale | Use of function 'setlocale'. | | test.cpp:13:3:13:11 | call to setlocale | Use of function 'setlocale'. | | test.cpp:14:3:14:11 | call to setlocale | Use of function 'setlocale'. | diff --git a/cpp/autosar/test/rules/A18-0-3/LocaleTypeLConvUsed.expected b/cpp/autosar/test/rules/A18-0-3/LocaleTypeLConvUsed.expected index 4e93c94f9b..c83be2cb1c 100644 --- a/cpp/autosar/test/rules/A18-0-3/LocaleTypeLConvUsed.expected +++ b/cpp/autosar/test/rules/A18-0-3/LocaleTypeLConvUsed.expected @@ -1,2 +1,2 @@ -| test.cpp:10:8:10:12 | type mention | Use of type 'std::lconv'. | +| test.cpp:10:8:10:12 | type mention | Use of type 'lconv'. | | test.cpp:18:3:18:7 | type mention | Use of type 'lconv'. | diff --git a/cpp/autosar/test/rules/M18-2-1/MacroOffsetofUsed.expected.gcc b/cpp/autosar/test/rules/M18-2-1/MacroOffsetofUsed.expected.gcc new file mode 100644 index 0000000000..f09fafd410 --- /dev/null +++ b/cpp/autosar/test/rules/M18-2-1/MacroOffsetofUsed.expected.gcc @@ -0,0 +1 @@ +| test.cpp:9:32:9:51 | offsetof(__typ,__id) | Use of banned macro offsetof. | diff --git a/cpp/autosar/test/rules/M18-2-1/MacroOffsetofUsed.expected.qcc b/cpp/autosar/test/rules/M18-2-1/MacroOffsetofUsed.expected.qcc new file mode 100644 index 0000000000..f09fafd410 --- /dev/null +++ b/cpp/autosar/test/rules/M18-2-1/MacroOffsetofUsed.expected.qcc @@ -0,0 +1 @@ +| test.cpp:9:32:9:51 | offsetof(__typ,__id) | Use of banned macro offsetof. | diff --git a/cpp/autosar/test/rules/M18-7-1/CsignalFunctionsUsed.expected b/cpp/autosar/test/rules/M18-7-1/CsignalFunctionsUsed.expected index 8806bacfe7..2cc8431463 100644 --- a/cpp/autosar/test/rules/M18-7-1/CsignalFunctionsUsed.expected +++ b/cpp/autosar/test/rules/M18-7-1/CsignalFunctionsUsed.expected @@ -1,4 +1,4 @@ -| test.cpp:7:3:7:13 | call to signal | Use of function 'std::signal'. | -| test.cpp:8:3:8:12 | call to raise | Use of function 'std::raise'. | +| test.cpp:7:3:7:13 | call to signal | Use of function 'signal'. | +| test.cpp:8:3:8:12 | call to raise | Use of function 'raise'. | | test.cpp:11:3:11:8 | call to signal | Use of function 'signal'. | | test.cpp:12:3:12:7 | call to raise | Use of function 'raise'. | diff --git a/cpp/autosar/test/rules/M18-7-1/CsignalTypesUsed.expected b/cpp/autosar/test/rules/M18-7-1/CsignalTypesUsed.expected index fda560380f..0ec502c3ac 100644 --- a/cpp/autosar/test/rules/M18-7-1/CsignalTypesUsed.expected +++ b/cpp/autosar/test/rules/M18-7-1/CsignalTypesUsed.expected @@ -1,2 +1,2 @@ -| test.cpp:6:8:6:19 | type mention | Use of type 'std::sig_atomic_t'. | +| test.cpp:6:8:6:19 | type mention | Use of type 'sig_atomic_t'. | | test.cpp:10:3:10:14 | type mention | Use of type 'sig_atomic_t'. | diff --git a/cpp/autosar/test/rules/M27-0-1/CstdioFunctionsUsed.expected b/cpp/autosar/test/rules/M27-0-1/CstdioFunctionsUsed.expected index 241d2281ef..54f341887a 100644 --- a/cpp/autosar/test/rules/M27-0-1/CstdioFunctionsUsed.expected +++ b/cpp/autosar/test/rules/M27-0-1/CstdioFunctionsUsed.expected @@ -1,20 +1,20 @@ -| test.cpp:4:18:4:27 | call to fopen | Use of function 'std::fopen'. | -| test.cpp:7:3:7:14 | call to fgetpos | Use of function 'std::fgetpos'. | -| test.cpp:9:11:9:19 | call to feof | Use of function 'std::feof'. | -| test.cpp:10:14:10:23 | call to fgetc | Use of function 'std::fgetc'. | -| test.cpp:12:7:12:17 | call to rewind | Use of function 'std::rewind'. | -| test.cpp:14:7:14:17 | call to ferror | Use of function 'std::ferror'. | -| test.cpp:15:5:15:17 | call to clearerr | Use of function 'std::clearerr'. | -| test.cpp:16:5:16:15 | call to fclose | Use of function 'std::fclose'. | -| test.cpp:17:5:17:15 | call to perror | Use of function 'std::perror'. | -| test.cpp:20:3:20:12 | call to fseek | Use of function 'std::fseek'. | -| test.cpp:21:3:21:12 | call to fseek | Use of function 'std::fseek'. | -| test.cpp:23:3:23:12 | call to fread | Use of function 'std::fread'. | -| test.cpp:25:3:25:14 | call to fsetpos | Use of function 'std::fsetpos'. | -| test.cpp:26:3:26:13 | call to fflush | Use of function 'std::fflush'. | -| test.cpp:27:3:27:13 | call to fclose | Use of function 'std::fclose'. | -| test.cpp:29:3:29:13 | call to printf | Use of function 'std::printf'. | -| test.cpp:31:3:31:11 | call to puts | Use of function 'std::puts'. | +| test.cpp:4:18:4:27 | call to fopen | Use of function 'fopen'. | +| test.cpp:7:3:7:14 | call to fgetpos | Use of function 'fgetpos'. | +| test.cpp:9:11:9:19 | call to feof | Use of function 'feof'. | +| test.cpp:10:14:10:23 | call to fgetc | Use of function 'fgetc'. | +| test.cpp:12:7:12:17 | call to rewind | Use of function 'rewind'. | +| test.cpp:14:7:14:17 | call to ferror | Use of function 'ferror'. | +| test.cpp:15:5:15:17 | call to clearerr | Use of function 'clearerr'. | +| test.cpp:16:5:16:15 | call to fclose | Use of function 'fclose'. | +| test.cpp:17:5:17:15 | call to perror | Use of function 'perror'. | +| test.cpp:20:3:20:12 | call to fseek | Use of function 'fseek'. | +| test.cpp:21:3:21:12 | call to fseek | Use of function 'fseek'. | +| test.cpp:23:3:23:12 | call to fread | Use of function 'fread'. | +| test.cpp:25:3:25:14 | call to fsetpos | Use of function 'fsetpos'. | +| test.cpp:26:3:26:13 | call to fflush | Use of function 'fflush'. | +| test.cpp:27:3:27:13 | call to fclose | Use of function 'fclose'. | +| test.cpp:29:3:29:13 | call to printf | Use of function 'printf'. | +| test.cpp:31:3:31:11 | call to puts | Use of function 'puts'. | | test.cpp:34:14:34:18 | call to fopen | Use of function 'fopen'. | | test.cpp:37:3:37:9 | call to fgetpos | Use of function 'fgetpos'. | | test.cpp:39:11:39:14 | call to feof | Use of function 'feof'. | diff --git a/cpp/autosar/test/rules/M27-0-1/CstdioTypesUsed.expected b/cpp/autosar/test/rules/M27-0-1/CstdioTypesUsed.expected index 037f54c05e..ed5a448ace 100644 --- a/cpp/autosar/test/rules/M27-0-1/CstdioTypesUsed.expected +++ b/cpp/autosar/test/rules/M27-0-1/CstdioTypesUsed.expected @@ -1,4 +1,4 @@ -| test.cpp:4:8:4:11 | type mention | Use of type 'std::FILE'. | -| test.cpp:6:8:6:13 | type mention | Use of type 'std::fpos_t'. | +| test.cpp:4:8:4:11 | type mention | Use of type 'FILE'. | +| test.cpp:6:8:6:13 | type mention | Use of type 'fpos_t'. | | test.cpp:34:3:34:6 | type mention | Use of type 'FILE'. | | test.cpp:36:3:36:8 | type mention | Use of type 'fpos_t'. | diff --git a/cpp/cert/test/rules/ERR59-CPP/DoNotThrowAnExceptionAcrossExecutionBoundaries.expected.clang b/cpp/cert/test/rules/ERR59-CPP/DoNotThrowAnExceptionAcrossExecutionBoundaries.expected.clang new file mode 100644 index 0000000000..e69de29bb2 diff --git a/cpp/cert/test/rules/ERR59-CPP/DoNotThrowAnExceptionAcrossExecutionBoundaries.expected.gcc b/cpp/cert/test/rules/ERR59-CPP/DoNotThrowAnExceptionAcrossExecutionBoundaries.expected.gcc new file mode 100644 index 0000000000..e69de29bb2 diff --git a/cpp/cert/test/rules/ERR59-CPP/DoNotThrowAnExceptionAcrossExecutionBoundaries.expected.qcc b/cpp/cert/test/rules/ERR59-CPP/DoNotThrowAnExceptionAcrossExecutionBoundaries.expected.qcc new file mode 100644 index 0000000000..e69de29bb2 diff --git a/cpp/common/test/includes/standard-library/clocale b/cpp/common/test/includes/standard-library/clocale index da05144f67..430c36daa0 100644 --- a/cpp/common/test/includes/standard-library/clocale +++ b/cpp/common/test/includes/standard-library/clocale @@ -8,13 +8,10 @@ #define LC_NUMERIC 0 #define LC_TIME 0 +#include + namespace std { -struct lconv; -char *setlocale(int, const char *); -lconv *localeconv(); +using ::lconv; +using ::localeconv; +using ::setlocale; } // namespace std - -// global namespace -struct lconv; -char *setlocale(int, const char *); -lconv *localeconv(); \ No newline at end of file diff --git a/cpp/common/test/includes/standard-library/csignal b/cpp/common/test/includes/standard-library/csignal index 0cded25e15..4c3b565256 100644 --- a/cpp/common/test/includes/standard-library/csignal +++ b/cpp/common/test/includes/standard-library/csignal @@ -10,13 +10,10 @@ #define SIG_IGN 7 #define SIG_ERR 8 -namespace std { -typedef int sig_atomic_t; -void (*signal(int, void (*func)(int)))(int); -int raise(int sig); -} // namespace std +#include -// global namespace -typedef int sig_atomic_t; -void (*signal(int, void (*func)(int)))(int); -int raise(int); \ No newline at end of file +namespace std { +using ::raise; +using ::sig_atomic_t; +using ::signal; +} // namespace std \ No newline at end of file diff --git a/cpp/common/test/includes/standard-library/cstdio b/cpp/common/test/includes/standard-library/cstdio index 65dde7279d..e40fc5458c 100644 --- a/cpp/common/test/includes/standard-library/cstdio +++ b/cpp/common/test/includes/standard-library/cstdio @@ -16,135 +16,55 @@ #define SEEK_END -1 #define stderr 0 -namespace std { -struct FILE; -typedef int fpos_t; - -// Operations on files -int remove(const char *filename); -int rename(const char *oldname, const char *newname); -FILE *tmpfile(void); -char *tmpnam(char *str); - -// File access -int fclose(FILE *stream); -int fflush(FILE *stream); -FILE *fopen(const char *filename, const char *mode); -FILE *freopen(const char *filename, const char *mode, FILE *stream); -void setbuf(FILE *stream, char *buffer); -int setvbuf(FILE *stream, char *buffer, int mode, size_t size); - -// Formatted input/output -int fprintf(FILE *stream, const char *format, ...); -int fscanf(FILE *stream, const char *format, ...); -int printf(const char *format, ...); -int scanf(const char *format, ...); -int snprintf(char *s, size_t n, const char *format, ...); -int sprintf(char *str, const char *format, ...); -int sscanf(const char *s, const char *format, ...); -/* -int vfprintf ( FILE * stream, const char * format, va_list arg ); -int vfscanf ( FILE * stream, const char * format, va_list arg ); -int vprintf ( const char * format, va_list arg ); -int vscanf ( const char * format, va_list arg ); -int vsnprintf (char * s, size_t n, const char * format, va_list arg ); -int vsprintf (char * s, const char * format, va_list arg ); -int vsscanf ( const char * s, const char * format, va_list arg ); -*/ - -// Character input/output -int fgetc(FILE *stream); -char *fgets(char *str, int num, FILE *stream); -int fputc(int character, FILE *stream); -int fputs(const char *str, FILE *stream); -int getc(FILE *stream); -int getchar(void); -char *gets(char *str); -int putc(int character, FILE *stream); -int putchar(int character); -int puts(const char *str); -int ungetc(int character, FILE *stream); - -// Direct input/output -size_t fread(void *ptr, size_t size, size_t count, FILE *stream); -size_t fwrite(const void *ptr, size_t size, size_t count, FILE *stream); - -// File positioning -int fgetpos(FILE *stream, fpos_t *pos); -int fseek(FILE *stream, long int offset, int origin); -int fsetpos(FILE *stream, const fpos_t *pos); -long int ftell(FILE *stream); -void rewind(FILE *stream); - -// Error-handling -void clearerr(FILE *stream); -int feof(FILE *stream); -int ferror(FILE *stream); -void perror(const char *str); -} // namespace std +#include -// global namespace -struct FILE; -typedef int fpos_t; - -// Operations on files -int remove(const char *filename); -int rename(const char *oldname, const char *newname); -FILE *tmpfile(void); -char *tmpnam(char *str); - -// File access -int fclose(FILE *stream); -int fflush(FILE *stream); -FILE *fopen(const char *filename, const char *mode); -FILE *freopen(const char *filename, const char *mode, FILE *stream); -void setbuf(FILE *stream, char *buffer); -int setvbuf(FILE *stream, char *buffer, int mode, size_t size); - -// Formatted input/output -int fprintf(FILE *stream, const char *format, ...); -int fscanf(FILE *stream, const char *format, ...); -int printf(const char *format, ...); -int scanf(const char *format, ...); -int snprintf(char *s, size_t n, const char *format, ...); -int sprintf(char *str, const char *format, ...); -int sscanf(const char *s, const char *format, ...); -/* -int vfprintf ( FILE * stream, const char * format, va_list arg ); -int vfscanf ( FILE * stream, const char * format, va_list arg ); -int vprintf ( const char * format, va_list arg ); -int vscanf ( const char * format, va_list arg ); -int vsnprintf (char * s, size_t n, const char * format, va_list arg ); -int vsprintf (char * s, const char * format, va_list arg ); -int vsscanf ( const char * s, const char * format, va_list arg ); -*/ - -// Character input/output -int fgetc(FILE *stream); -char *fgets(char *str, int num, FILE *stream); -int fputc(int character, FILE *stream); -int fputs(const char *str, FILE *stream); -int getc(FILE *stream); -int getchar(void); -char *gets(char *str); -int putc(int character, FILE *stream); -int putchar(int character); -int puts(const char *str); -int ungetc(int character, FILE *stream); - -// Direct input/output -size_t fread(void *ptr, size_t size, size_t count, FILE *stream); -size_t fwrite(const void *ptr, size_t size, size_t count, FILE *stream); - -// File positioning -int fgetpos(FILE *stream, fpos_t *pos); -int fseek(FILE *stream, long int offset, int origin); -int fsetpos(FILE *stream, const fpos_t *pos); -long int ftell(FILE *stream); -void rewind(FILE *stream); - -// Error-handling -void clearerr(FILE *stream); -int feof(FILE *stream); -int ferror(FILE *stream); -void perror(const char *str); \ No newline at end of file +namespace std { +using ::FILE; +using ::fpos_t; + +using ::remove; +using ::rename; +using ::tmpfile; +using ::tmpnam; + +using ::fclose; +using ::fflush; +using ::fopen; +using ::freopen; +using ::setbuf; +using ::setvbuf; + +using ::fprintf; +using ::fscanf; +using ::printf; +using ::scanf; +using ::snprintf; +using ::sprintf; +using ::sscanf; + +using ::fgetc; +using ::fgets; +using ::fputc; +using ::fputs; +using ::getc; +using ::getchar; +using ::gets; +using ::putc; +using ::putchar; +using ::puts; +using ::ungetc; + +using ::fread; +using ::fwrite; + +using ::fgetpos; +using ::fseek; +using ::fsetpos; +using ::ftell; +using ::rewind; + +using ::clearerr; +using ::feof; +using ::ferror; +using ::perror; +} // namespace std \ No newline at end of file diff --git a/cpp/common/test/includes/standard-library/cstdlib.h b/cpp/common/test/includes/standard-library/cstdlib.h index b2c87ada66..4a2d0cd9ee 100644 --- a/cpp/common/test/includes/standard-library/cstdlib.h +++ b/cpp/common/test/includes/standard-library/cstdlib.h @@ -7,10 +7,10 @@ namespace std { [[noreturn]] void quick_exit(int status) noexcept; extern "C++" int atexit(void (*f)(void)) noexcept; extern "C++" int at_quick_exit(void (*f)(void)) noexcept; -extern "C++" long rand() noexcept; using ::atof; using ::atoi; using ::atol; using ::atoll; +using ::rand; } // namespace std #endif // _GHLIBCPP_CSTDLIB \ No newline at end of file diff --git a/cpp/common/test/includes/standard-library/locale.h b/cpp/common/test/includes/standard-library/locale.h index e69de29bb2..346c4eeef5 100644 --- a/cpp/common/test/includes/standard-library/locale.h +++ b/cpp/common/test/includes/standard-library/locale.h @@ -0,0 +1,8 @@ +#ifndef _GHLIBCPP_LOCALE +#define _GHLIBCPP_LOCALE + +struct lconv; +char *setlocale(int, const char *); +lconv *localeconv(); + +#endif // _GHLIBCPP_LOCALE \ No newline at end of file diff --git a/cpp/common/test/includes/standard-library/signal.h b/cpp/common/test/includes/standard-library/signal.h index e69de29bb2..b9ac81919a 100644 --- a/cpp/common/test/includes/standard-library/signal.h +++ b/cpp/common/test/includes/standard-library/signal.h @@ -0,0 +1,8 @@ +#ifndef _GHLIBCPP_SIGNAL +#define _GHLIBCPP_SIGNAL + +typedef int sig_atomic_t; +void (*signal(int, void (*func)(int)))(int); +int raise(int); + +#endif // _GHLIBCPP_SIGNAL \ No newline at end of file diff --git a/cpp/common/test/includes/standard-library/stdio.h b/cpp/common/test/includes/standard-library/stdio.h index b1a36a4af0..30ca17bcaf 100644 --- a/cpp/common/test/includes/standard-library/stdio.h +++ b/cpp/common/test/includes/standard-library/stdio.h @@ -1,5 +1,84 @@ +#ifndef _GHLIBCPP_STDIO +#define _GHLIBCPP_STDIO + +#include + typedef void FILE; +typedef int fpos_t; + +// Operations on files +int remove(const char *filename); +int rename(const char *oldname, const char *newname); +FILE *tmpfile(void); +char *tmpnam(char *str); + +// File access +int fclose(FILE *stream); +int fflush(FILE *stream); +FILE *fopen(const char *filename, const char *mode); +FILE *freopen(const char *filename, const char *mode, FILE *stream); +void setbuf(FILE *stream, char *buffer); +int setvbuf(FILE *stream, char *buffer, int mode, size_t size); + +// Formatted input/output +int fprintf(FILE *stream, const char *format, ...); +int fscanf(FILE *stream, const char *format, ...); +int printf(const char *format, ...); +int scanf(const char *format, ...); +int snprintf(char *s, size_t n, const char *format, ...); +int sprintf(char *str, const char *format, ...); +int sscanf(const char *s, const char *format, ...); +/* +int vfprintf ( FILE * stream, const char * format, va_list arg ); +int vfscanf ( FILE * stream, const char * format, va_list arg ); +int vprintf ( const char * format, va_list arg ); +int vscanf ( const char * format, va_list arg ); +int vsnprintf (char * s, size_t n, const char * format, va_list arg ); +int vsprintf (char * s, const char * format, va_list arg ); +int vsscanf ( const char * s, const char * format, va_list arg ); +*/ + +// Character input/output +int fgetc(FILE *stream); +char *fgets(char *str, int num, FILE *stream); +int fputc(int character, FILE *stream); +int fputs(const char *str, FILE *stream); +int getc(FILE *stream); +int getchar(void); +char *gets(char *str); +int putc(int character, FILE *stream); +int putchar(int character); +int puts(const char *str); +int ungetc(int character, FILE *stream); + +// Character input/output +int fgetc(FILE *stream); +char *fgets(char *str, int num, FILE *stream); +int fputc(int character, FILE *stream); +int fputs(const char *str, FILE *stream); +int getc(FILE *stream); +int getchar(void); +char *gets(char *str); +int putc(int character, FILE *stream); +int putchar(int character); +int puts(const char *str); +int ungetc(int character, FILE *stream); + +// Direct input/output +size_t fread(void *ptr, size_t size, size_t count, FILE *stream); +size_t fwrite(const void *ptr, size_t size, size_t count, FILE *stream); + +// File positioning +int fgetpos(FILE *stream, fpos_t *pos); +int fseek(FILE *stream, long int offset, int origin); +int fsetpos(FILE *stream, const fpos_t *pos); +long int ftell(FILE *stream); +void rewind(FILE *stream); + +// Error-handling +void clearerr(FILE *stream); +int feof(FILE *stream); +int ferror(FILE *stream); +void perror(const char *str); -FILE *fopen(const char *, const char *); -int fclose(FILE *); -int remove(const char *); \ No newline at end of file +#endif // _GHLIBCPP_STDIO \ No newline at end of file diff --git a/cpp/common/test/includes/standard-library/stdlib.h b/cpp/common/test/includes/standard-library/stdlib.h index 37902b52bb..c8ff7a7592 100644 --- a/cpp/common/test/includes/standard-library/stdlib.h +++ b/cpp/common/test/includes/standard-library/stdlib.h @@ -20,4 +20,6 @@ long int atol(const char *str); long long int atoll(const char *str); double atof(const char *str); +int rand(void); + #endif // _GHLIBCPP_STDLIB \ No newline at end of file diff --git a/cpp/common/test/rules/donotuserandforgeneratingpseudorandomnumbers/DoNotUseRandForGeneratingPseudorandomNumbers.expected b/cpp/common/test/rules/donotuserandforgeneratingpseudorandomnumbers/DoNotUseRandForGeneratingPseudorandomNumbers.expected index 2b4bcde88a..eaefe65ca3 100644 --- a/cpp/common/test/rules/donotuserandforgeneratingpseudorandomnumbers/DoNotUseRandForGeneratingPseudorandomNumbers.expected +++ b/cpp/common/test/rules/donotuserandforgeneratingpseudorandomnumbers/DoNotUseRandForGeneratingPseudorandomNumbers.expected @@ -1 +1 @@ -| test.cpp:5:47:5:55 | call to rand | Use of banned function std::rand. | +| test.cpp:5:47:5:55 | call to rand | Use of banned function rand. | diff --git a/scripts/matrix_testing/CreateMatrixTestReport.ps1 b/scripts/matrix_testing/CreateMatrixTestReport.ps1 index d80e87e426..0cf48ac36c 100644 --- a/scripts/matrix_testing/CreateMatrixTestReport.ps1 +++ b/scripts/matrix_testing/CreateMatrixTestReport.ps1 @@ -299,6 +299,11 @@ $jobRows = $queriesToCheck | ForEach-Object -ThrottleLimit $NumThreads -Parallel foreach($testDirectory in $testDirs){ + Write-Host "Acquiring lock for $testDirectory" + $Mutex = New-Object -TypeName System.Threading.Mutex -ArgumentList $false, ("__Matrix_" + $testDirectory.Replace([IO.Path]::DirectorySeparatorChar,"_")); + $Mutex.WaitOne() | Out-Null; + Write-Host "Locked $testDirectory" + # for the report $row = @{ "SUITE" = $CurrentSuiteName; @@ -412,6 +417,8 @@ $jobRows = $queriesToCheck | ForEach-Object -ThrottleLimit $NumThreads -Parallel # output current row state $row + # release any held mutexes + $Mutex.ReleaseMutex(); ########################################################### ########################################################### @@ -449,4 +456,4 @@ if (-not $SkipSummaryReport){ # write out a summary Write-Host "Writing summary report to $summaryReportOutputFile" Create-Summary-Report -DataFile $reportOutputFile -OutputFile $summaryReportOutputFile -} \ No newline at end of file +}