Skip to content

Commit 9de7232

Browse files
authored
Merge pull request #299 from github/cpp-compiler-compat-update-results
Address "Updated expected results" C++ compiler compatibility issues
2 parents 38f8878 + 2847322 commit 9de7232

27 files changed

+209
-188
lines changed

change_notes/2023-04-28-a14-7-2.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
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.

cpp/autosar/src/rules/A14-7-2/TemplateSpecializationNotDeclaredInTheSameFile.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,4 +58,4 @@ where
5858
not spec.getFile() = spec.getPrimary().getFile() and
5959
not extraExclude(spec)
6060
select spec, "Specialization found in file $@ where primary template is outside that file.",
61-
spec.getFile(), spec.getFile().getRelativePath()
61+
spec.getFile(), spec.getFile().getBaseName()
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
| test.cpp:5:20:5:25 | s<int> | 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 |
2-
| 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 |
3-
| test.cpp:13:19:13:28 | vector<s1, allocator<s1>> | 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 |
1+
| test.cpp:5:20:5:25 | s<int> | Specialization found in file $@ where primary template is outside that file. | test.cpp:0:0:0:0 | test.cpp | test.cpp |
2+
| 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 |
3+
| test.cpp:13:19:13:28 | vector<s1, allocator<s1>> | Specialization found in file $@ where primary template is outside that file. | test.cpp:0:0:0:0 | test.cpp | test.cpp |

cpp/autosar/test/rules/A15-1-5/ExceptionsThrownAcrossExecutionBoundaries.expected.clang

Whitespace-only changes.

cpp/autosar/test/rules/A15-1-5/ExceptionsThrownAcrossExecutionBoundaries.expected.gcc

Whitespace-only changes.

cpp/autosar/test/rules/A15-1-5/ExceptionsThrownAcrossExecutionBoundaries.expected.qcc

Whitespace-only changes.

cpp/autosar/test/rules/A18-0-3/LocaleFunctionsUsed.expected

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
| test.cpp:4:3:4:16 | call to setlocale | Use of <clocale> function 'std::setlocale'. |
2-
| test.cpp:5:3:5:16 | call to setlocale | Use of <clocale> function 'std::setlocale'. |
3-
| test.cpp:6:3:6:16 | call to setlocale | Use of <clocale> function 'std::setlocale'. |
4-
| test.cpp:7:3:7:16 | call to setlocale | Use of <clocale> function 'std::setlocale'. |
5-
| test.cpp:8:3:8:16 | call to setlocale | Use of <clocale> function 'std::setlocale'. |
6-
| test.cpp:9:3:9:16 | call to setlocale | Use of <clocale> function 'std::setlocale'. |
7-
| test.cpp:10:20:10:34 | call to localeconv | Use of <clocale> function 'std::localeconv'. |
1+
| test.cpp:4:3:4:16 | call to setlocale | Use of <clocale> function 'setlocale'. |
2+
| test.cpp:5:3:5:16 | call to setlocale | Use of <clocale> function 'setlocale'. |
3+
| test.cpp:6:3:6:16 | call to setlocale | Use of <clocale> function 'setlocale'. |
4+
| test.cpp:7:3:7:16 | call to setlocale | Use of <clocale> function 'setlocale'. |
5+
| test.cpp:8:3:8:16 | call to setlocale | Use of <clocale> function 'setlocale'. |
6+
| test.cpp:9:3:9:16 | call to setlocale | Use of <clocale> function 'setlocale'. |
7+
| test.cpp:10:20:10:34 | call to localeconv | Use of <clocale> function 'localeconv'. |
88
| test.cpp:12:3:12:11 | call to setlocale | Use of <clocale> function 'setlocale'. |
99
| test.cpp:13:3:13:11 | call to setlocale | Use of <clocale> function 'setlocale'. |
1010
| test.cpp:14:3:14:11 | call to setlocale | Use of <clocale> function 'setlocale'. |
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
| test.cpp:10:8:10:12 | type mention | Use of <clocale> type 'std::lconv'. |
1+
| test.cpp:10:8:10:12 | type mention | Use of <clocale> type 'lconv'. |
22
| test.cpp:18:3:18:7 | type mention | Use of <clocale> type 'lconv'. |
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
| test.cpp:9:32:9:51 | offsetof(__typ,__id) | Use of banned macro offsetof. |
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
| test.cpp:9:32:9:51 | offsetof(__typ,__id) | Use of banned macro offsetof. |
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
| test.cpp:7:3:7:13 | call to signal | Use of <csignal> function 'std::signal'. |
2-
| test.cpp:8:3:8:12 | call to raise | Use of <csignal> function 'std::raise'. |
1+
| test.cpp:7:3:7:13 | call to signal | Use of <csignal> function 'signal'. |
2+
| test.cpp:8:3:8:12 | call to raise | Use of <csignal> function 'raise'. |
33
| test.cpp:11:3:11:8 | call to signal | Use of <csignal> function 'signal'. |
44
| test.cpp:12:3:12:7 | call to raise | Use of <csignal> function 'raise'. |
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
| test.cpp:6:8:6:19 | type mention | Use of <csignal> type 'std::sig_atomic_t'. |
1+
| test.cpp:6:8:6:19 | type mention | Use of <csignal> type 'sig_atomic_t'. |
22
| test.cpp:10:3:10:14 | type mention | Use of <csignal> type 'sig_atomic_t'. |

cpp/autosar/test/rules/M27-0-1/CstdioFunctionsUsed.expected

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1-
| test.cpp:4:18:4:27 | call to fopen | Use of <cstdio> function 'std::fopen'. |
2-
| test.cpp:7:3:7:14 | call to fgetpos | Use of <cstdio> function 'std::fgetpos'. |
3-
| test.cpp:9:11:9:19 | call to feof | Use of <cstdio> function 'std::feof'. |
4-
| test.cpp:10:14:10:23 | call to fgetc | Use of <cstdio> function 'std::fgetc'. |
5-
| test.cpp:12:7:12:17 | call to rewind | Use of <cstdio> function 'std::rewind'. |
6-
| test.cpp:14:7:14:17 | call to ferror | Use of <cstdio> function 'std::ferror'. |
7-
| test.cpp:15:5:15:17 | call to clearerr | Use of <cstdio> function 'std::clearerr'. |
8-
| test.cpp:16:5:16:15 | call to fclose | Use of <cstdio> function 'std::fclose'. |
9-
| test.cpp:17:5:17:15 | call to perror | Use of <cstdio> function 'std::perror'. |
10-
| test.cpp:20:3:20:12 | call to fseek | Use of <cstdio> function 'std::fseek'. |
11-
| test.cpp:21:3:21:12 | call to fseek | Use of <cstdio> function 'std::fseek'. |
12-
| test.cpp:23:3:23:12 | call to fread | Use of <cstdio> function 'std::fread'. |
13-
| test.cpp:25:3:25:14 | call to fsetpos | Use of <cstdio> function 'std::fsetpos'. |
14-
| test.cpp:26:3:26:13 | call to fflush | Use of <cstdio> function 'std::fflush'. |
15-
| test.cpp:27:3:27:13 | call to fclose | Use of <cstdio> function 'std::fclose'. |
16-
| test.cpp:29:3:29:13 | call to printf | Use of <cstdio> function 'std::printf'. |
17-
| test.cpp:31:3:31:11 | call to puts | Use of <cstdio> function 'std::puts'. |
1+
| test.cpp:4:18:4:27 | call to fopen | Use of <cstdio> function 'fopen'. |
2+
| test.cpp:7:3:7:14 | call to fgetpos | Use of <cstdio> function 'fgetpos'. |
3+
| test.cpp:9:11:9:19 | call to feof | Use of <cstdio> function 'feof'. |
4+
| test.cpp:10:14:10:23 | call to fgetc | Use of <cstdio> function 'fgetc'. |
5+
| test.cpp:12:7:12:17 | call to rewind | Use of <cstdio> function 'rewind'. |
6+
| test.cpp:14:7:14:17 | call to ferror | Use of <cstdio> function 'ferror'. |
7+
| test.cpp:15:5:15:17 | call to clearerr | Use of <cstdio> function 'clearerr'. |
8+
| test.cpp:16:5:16:15 | call to fclose | Use of <cstdio> function 'fclose'. |
9+
| test.cpp:17:5:17:15 | call to perror | Use of <cstdio> function 'perror'. |
10+
| test.cpp:20:3:20:12 | call to fseek | Use of <cstdio> function 'fseek'. |
11+
| test.cpp:21:3:21:12 | call to fseek | Use of <cstdio> function 'fseek'. |
12+
| test.cpp:23:3:23:12 | call to fread | Use of <cstdio> function 'fread'. |
13+
| test.cpp:25:3:25:14 | call to fsetpos | Use of <cstdio> function 'fsetpos'. |
14+
| test.cpp:26:3:26:13 | call to fflush | Use of <cstdio> function 'fflush'. |
15+
| test.cpp:27:3:27:13 | call to fclose | Use of <cstdio> function 'fclose'. |
16+
| test.cpp:29:3:29:13 | call to printf | Use of <cstdio> function 'printf'. |
17+
| test.cpp:31:3:31:11 | call to puts | Use of <cstdio> function 'puts'. |
1818
| test.cpp:34:14:34:18 | call to fopen | Use of <cstdio> function 'fopen'. |
1919
| test.cpp:37:3:37:9 | call to fgetpos | Use of <cstdio> function 'fgetpos'. |
2020
| test.cpp:39:11:39:14 | call to feof | Use of <cstdio> function 'feof'. |
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
| test.cpp:4:8:4:11 | type mention | Use of <cstdio> type 'std::FILE'. |
2-
| test.cpp:6:8:6:13 | type mention | Use of <cstdio> type 'std::fpos_t'. |
1+
| test.cpp:4:8:4:11 | type mention | Use of <cstdio> type 'FILE'. |
2+
| test.cpp:6:8:6:13 | type mention | Use of <cstdio> type 'fpos_t'. |
33
| test.cpp:34:3:34:6 | type mention | Use of <cstdio> type 'FILE'. |
44
| test.cpp:36:3:36:8 | type mention | Use of <cstdio> type 'fpos_t'. |

cpp/cert/test/rules/ERR59-CPP/DoNotThrowAnExceptionAcrossExecutionBoundaries.expected.clang

Whitespace-only changes.

cpp/cert/test/rules/ERR59-CPP/DoNotThrowAnExceptionAcrossExecutionBoundaries.expected.gcc

Whitespace-only changes.

cpp/cert/test/rules/ERR59-CPP/DoNotThrowAnExceptionAcrossExecutionBoundaries.expected.qcc

Whitespace-only changes.

cpp/common/test/includes/standard-library/clocale

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,10 @@
88
#define LC_NUMERIC 0
99
#define LC_TIME 0
1010

11+
#include <locale.h>
12+
1113
namespace std {
12-
struct lconv;
13-
char *setlocale(int, const char *);
14-
lconv *localeconv();
14+
using ::lconv;
15+
using ::localeconv;
16+
using ::setlocale;
1517
} // namespace std
16-
17-
// global namespace
18-
struct lconv;
19-
char *setlocale(int, const char *);
20-
lconv *localeconv();

cpp/common/test/includes/standard-library/csignal

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,10 @@
1010
#define SIG_IGN 7
1111
#define SIG_ERR 8
1212

13-
namespace std {
14-
typedef int sig_atomic_t;
15-
void (*signal(int, void (*func)(int)))(int);
16-
int raise(int sig);
17-
} // namespace std
13+
#include <signal.h>
1814

19-
// global namespace
20-
typedef int sig_atomic_t;
21-
void (*signal(int, void (*func)(int)))(int);
22-
int raise(int);
15+
namespace std {
16+
using ::raise;
17+
using ::sig_atomic_t;
18+
using ::signal;
19+
} // namespace std

cpp/common/test/includes/standard-library/cstdio

Lines changed: 51 additions & 131 deletions
Original file line numberDiff line numberDiff line change
@@ -16,135 +16,55 @@
1616
#define SEEK_END -1
1717
#define stderr 0
1818

19-
namespace std {
20-
struct FILE;
21-
typedef int fpos_t;
22-
23-
// Operations on files
24-
int remove(const char *filename);
25-
int rename(const char *oldname, const char *newname);
26-
FILE *tmpfile(void);
27-
char *tmpnam(char *str);
28-
29-
// File access
30-
int fclose(FILE *stream);
31-
int fflush(FILE *stream);
32-
FILE *fopen(const char *filename, const char *mode);
33-
FILE *freopen(const char *filename, const char *mode, FILE *stream);
34-
void setbuf(FILE *stream, char *buffer);
35-
int setvbuf(FILE *stream, char *buffer, int mode, size_t size);
36-
37-
// Formatted input/output
38-
int fprintf(FILE *stream, const char *format, ...);
39-
int fscanf(FILE *stream, const char *format, ...);
40-
int printf(const char *format, ...);
41-
int scanf(const char *format, ...);
42-
int snprintf(char *s, size_t n, const char *format, ...);
43-
int sprintf(char *str, const char *format, ...);
44-
int sscanf(const char *s, const char *format, ...);
45-
/*
46-
int vfprintf ( FILE * stream, const char * format, va_list arg );
47-
int vfscanf ( FILE * stream, const char * format, va_list arg );
48-
int vprintf ( const char * format, va_list arg );
49-
int vscanf ( const char * format, va_list arg );
50-
int vsnprintf (char * s, size_t n, const char * format, va_list arg );
51-
int vsprintf (char * s, const char * format, va_list arg );
52-
int vsscanf ( const char * s, const char * format, va_list arg );
53-
*/
54-
55-
// Character input/output
56-
int fgetc(FILE *stream);
57-
char *fgets(char *str, int num, FILE *stream);
58-
int fputc(int character, FILE *stream);
59-
int fputs(const char *str, FILE *stream);
60-
int getc(FILE *stream);
61-
int getchar(void);
62-
char *gets(char *str);
63-
int putc(int character, FILE *stream);
64-
int putchar(int character);
65-
int puts(const char *str);
66-
int ungetc(int character, FILE *stream);
67-
68-
// Direct input/output
69-
size_t fread(void *ptr, size_t size, size_t count, FILE *stream);
70-
size_t fwrite(const void *ptr, size_t size, size_t count, FILE *stream);
71-
72-
// File positioning
73-
int fgetpos(FILE *stream, fpos_t *pos);
74-
int fseek(FILE *stream, long int offset, int origin);
75-
int fsetpos(FILE *stream, const fpos_t *pos);
76-
long int ftell(FILE *stream);
77-
void rewind(FILE *stream);
78-
79-
// Error-handling
80-
void clearerr(FILE *stream);
81-
int feof(FILE *stream);
82-
int ferror(FILE *stream);
83-
void perror(const char *str);
84-
} // namespace std
19+
#include <stdio.h>
8520

86-
// global namespace
87-
struct FILE;
88-
typedef int fpos_t;
89-
90-
// Operations on files
91-
int remove(const char *filename);
92-
int rename(const char *oldname, const char *newname);
93-
FILE *tmpfile(void);
94-
char *tmpnam(char *str);
95-
96-
// File access
97-
int fclose(FILE *stream);
98-
int fflush(FILE *stream);
99-
FILE *fopen(const char *filename, const char *mode);
100-
FILE *freopen(const char *filename, const char *mode, FILE *stream);
101-
void setbuf(FILE *stream, char *buffer);
102-
int setvbuf(FILE *stream, char *buffer, int mode, size_t size);
103-
104-
// Formatted input/output
105-
int fprintf(FILE *stream, const char *format, ...);
106-
int fscanf(FILE *stream, const char *format, ...);
107-
int printf(const char *format, ...);
108-
int scanf(const char *format, ...);
109-
int snprintf(char *s, size_t n, const char *format, ...);
110-
int sprintf(char *str, const char *format, ...);
111-
int sscanf(const char *s, const char *format, ...);
112-
/*
113-
int vfprintf ( FILE * stream, const char * format, va_list arg );
114-
int vfscanf ( FILE * stream, const char * format, va_list arg );
115-
int vprintf ( const char * format, va_list arg );
116-
int vscanf ( const char * format, va_list arg );
117-
int vsnprintf (char * s, size_t n, const char * format, va_list arg );
118-
int vsprintf (char * s, const char * format, va_list arg );
119-
int vsscanf ( const char * s, const char * format, va_list arg );
120-
*/
121-
122-
// Character input/output
123-
int fgetc(FILE *stream);
124-
char *fgets(char *str, int num, FILE *stream);
125-
int fputc(int character, FILE *stream);
126-
int fputs(const char *str, FILE *stream);
127-
int getc(FILE *stream);
128-
int getchar(void);
129-
char *gets(char *str);
130-
int putc(int character, FILE *stream);
131-
int putchar(int character);
132-
int puts(const char *str);
133-
int ungetc(int character, FILE *stream);
134-
135-
// Direct input/output
136-
size_t fread(void *ptr, size_t size, size_t count, FILE *stream);
137-
size_t fwrite(const void *ptr, size_t size, size_t count, FILE *stream);
138-
139-
// File positioning
140-
int fgetpos(FILE *stream, fpos_t *pos);
141-
int fseek(FILE *stream, long int offset, int origin);
142-
int fsetpos(FILE *stream, const fpos_t *pos);
143-
long int ftell(FILE *stream);
144-
void rewind(FILE *stream);
145-
146-
// Error-handling
147-
void clearerr(FILE *stream);
148-
int feof(FILE *stream);
149-
int ferror(FILE *stream);
150-
void perror(const char *str);
21+
namespace std {
22+
using ::FILE;
23+
using ::fpos_t;
24+
25+
using ::remove;
26+
using ::rename;
27+
using ::tmpfile;
28+
using ::tmpnam;
29+
30+
using ::fclose;
31+
using ::fflush;
32+
using ::fopen;
33+
using ::freopen;
34+
using ::setbuf;
35+
using ::setvbuf;
36+
37+
using ::fprintf;
38+
using ::fscanf;
39+
using ::printf;
40+
using ::scanf;
41+
using ::snprintf;
42+
using ::sprintf;
43+
using ::sscanf;
44+
45+
using ::fgetc;
46+
using ::fgets;
47+
using ::fputc;
48+
using ::fputs;
49+
using ::getc;
50+
using ::getchar;
51+
using ::gets;
52+
using ::putc;
53+
using ::putchar;
54+
using ::puts;
55+
using ::ungetc;
56+
57+
using ::fread;
58+
using ::fwrite;
59+
60+
using ::fgetpos;
61+
using ::fseek;
62+
using ::fsetpos;
63+
using ::ftell;
64+
using ::rewind;
65+
66+
using ::clearerr;
67+
using ::feof;
68+
using ::ferror;
69+
using ::perror;
70+
} // namespace std

cpp/common/test/includes/standard-library/cstdlib.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ namespace std {
77
[[noreturn]] void quick_exit(int status) noexcept;
88
extern "C++" int atexit(void (*f)(void)) noexcept;
99
extern "C++" int at_quick_exit(void (*f)(void)) noexcept;
10-
extern "C++" long rand() noexcept;
1110
using ::atof;
1211
using ::atoi;
1312
using ::atol;
1413
using ::atoll;
14+
using ::rand;
1515
} // namespace std
1616
#endif // _GHLIBCPP_CSTDLIB
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#ifndef _GHLIBCPP_LOCALE
2+
#define _GHLIBCPP_LOCALE
3+
4+
struct lconv;
5+
char *setlocale(int, const char *);
6+
lconv *localeconv();
7+
8+
#endif // _GHLIBCPP_LOCALE
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#ifndef _GHLIBCPP_SIGNAL
2+
#define _GHLIBCPP_SIGNAL
3+
4+
typedef int sig_atomic_t;
5+
void (*signal(int, void (*func)(int)))(int);
6+
int raise(int);
7+
8+
#endif // _GHLIBCPP_SIGNAL

0 commit comments

Comments
 (0)