<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/54120>54120</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
why clang++ ignore -fpermissive but g++ works well? NEED HELP!!
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
jmp0x7c00
</td>
</tr>
</table>
<pre>
g++ works well
```bash
g++ -fpermissive -m64 -O3 -Wall -Winit-self -Wreturn-type -Wno-pointer-arith -Waddress -Wsequence-point -Wformat-security -Wmissing-include-dirs -Wundef -Wno-parentheses -Wcast-align -Wconversion -Wnon-virtual-dtor -std=c++11 -Wno-write-strings -nostdinc -fvisibility=hidden -fpie -fstack-protector -IEnclave -I/opt/sgxsdk/include -I/opt/sgxsdk/include/libcxx -I/opt/sgxsdk/include/tlibc -nostdinc++ -fpermissive -c Enclave/Enclave.cpp -o Enclave/Enclave.o -pedantic
In file included from /opt/sgxsdk/include/sgx_edger8r.h:46,
from Enclave/Enclave_t.h:7,
from Enclave/Enclave.cpp:1:
/opt/sgxsdk/include/sgx_defs.h:49:38: warning: ISO C++ does not permit named variadic macros [-Wvariadic-macros]
49 | #define SGX_UBRIDGE(attr, fname, args...) attr fname args
| ^~~
In file included from Enclave/Enclave_t.h:12,
from Enclave/Enclave.cpp:1:
Enclave/../Enclave/sgx_includes.h:248:15: warning: ISO C++ forbids zero-size array ‘data’ [-Wpedantic]
248 | char data[0] __attribute__ ((aligned (__alignof__ (long double))));
| ^
In file included from Enclave/Enclave_t.h:14,
from Enclave/Enclave.cpp:1:
/opt/sgxsdk/include/tlibc/stdlib.h:133:63: warning: extra ‘;’ [-Wpedantic]
133 | _TLIBC_DEPRECATED_FUNCTION_(int _TLIBC_CDECL_, rand, void);
| ^
/opt/sgxsdk/include/tlibc/stdlib.h:134:68: warning: extra ‘;’ [-Wpedantic]
134 | _TLIBC_DEPRECATED_FUNCTION_(void _TLIBC_CDECL_, srand, unsigned);
| ^
/opt/sgxsdk/include/tlibc/stdlib.h:135:62: warning: extra ‘;’ [-Wpedantic]
135 | _TLIBC_DEPRECATED_FUNCTION_(void _TLIBC_CDECL_, exit, int);
| ^
/opt/sgxsdk/include/tlibc/stdlib.h:136:63: warning: extra ‘;’ [-Wpedantic]
136 | _TLIBC_DEPRECATED_FUNCTION_(void _TLIBC_CDECL_, _Exit, int);
| ^
/opt/sgxsdk/include/tlibc/stdlib.h:137:73: warning: extra ‘;’ [-Wpedantic]
137 | _TLIBC_DEPRECATED_FUNCTION_(char * _TLIBC_CDECL_, getenv, const char *);
| ^
/opt/sgxsdk/include/tlibc/stdlib.h:138:73: warning: extra ‘;’ [-Wpedantic]
138 | _TLIBC_DEPRECATED_FUNCTION_(int _TLIBC_CDECL_, system, const char *);
| ^
In file included from Enclave/Enclave.cpp:3:
/opt/sgxsdk/include/tlibc/string.h:87:80: warning: extra ‘;’ [-Wpedantic]
87 | FUNCTION_(char * _TLIBC_CDECL_, strcat, char *, const char *);
| ^
/opt/sgxsdk/include/tlibc/string.h:88:80: warning: extra ‘;’ [-Wpedantic]
88 | FUNCTION_(char * _TLIBC_CDECL_, strcpy, char *, const char *);
| ^
/opt/sgxsdk/include/tlibc/string.h:120:72: warning: extra ‘;’ [-Wpedantic]
120 | _TLIBC_DEPRECATED_FUNCTION_(char * _TLIBC_CDECL_, strdup, const char *);
| ^
/opt/sgxsdk/include/tlibc/string.h:121:87: warning: extra ‘;’ [-Wpedantic]
121 | N_(char * _TLIBC_CDECL_, stpcpy, char *dest, const char *src);
| ^
In file included from Enclave/Enclave.cpp:5:
Enclave/sgx_funcs.h:16:8: warning: declaration of ‘size_t fwrite(void*, size_t, size_t, FILE*)’ conflicts with built-in declaration ‘long unsigned int fwrite(const void*, long unsigned int, long unsigned int, void*)’ [-Wbuiltin-declaration-mismatch]
16 | size_t fwrite(void *buffer, size_t size, size_t cont, FILE *fd);
| ^~~~~~
In file included from Enclave/Enclave.cpp:8:
/opt/sgxsdk/include/tlibc/unistd.h:50:87: warning: extra ‘;’ [-Wpedantic]
50 | N_(int _TLIBC_CDECL_, execl, const char *, const char *, ...);
| ^
/opt/sgxsdk/include/tlibc/unistd.h:51:88: warning: extra ‘;’ [-Wpedantic]
51 | _(int _TLIBC_CDECL_, execlp, const char *, const char *, ...);
| ^
/opt/sgxsdk/include/tlibc/unistd.h:52:88: warning: extra ‘;’ [-Wpedantic]
52 | _(int _TLIBC_CDECL_, execle, const char *, const char *, ...);
| ^
/opt/sgxsdk/include/tlibc/unistd.h:53:84: warning: extra ‘;’ [-Wpedantic]
53 | TION_(int _TLIBC_CDECL_, execv, const char *, char * const *);
| ^
/opt/sgxsdk/include/tlibc/unistd.h:54:101: warning: extra ‘;’ [-Wpedantic]
54 | CDECL_, execve, const char *, char * const *, char * const *);
| ^
/opt/sgxsdk/include/tlibc/unistd.h:55:85: warning: extra ‘;’ [-Wpedantic]
55 | ION_(int _TLIBC_CDECL_, execvp, const char *, char * const *);
| ^
Enclave/Enclave.cpp: In function ‘void ecall_start(emu_args)’:
Enclave/Enclave.cpp:90:16: warning: invalid conversion from ‘void*’ to ‘player_input*’ [-fpermissive]
90 | ap = malloc(sizeof(struct player_input));
| ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| |
| void*
Enclave/Enclave.cpp:92:15: warning: invalid conversion from ‘void*’ to ‘uint16_t*’ {aka ‘short unsigned int*’} [-fpermissive]
92 | b = malloc(23040 * 2);
| ~~~~~~^~~~~~~~~~~
| |
| void*
Enclave/Enclave.cpp: In function ‘void ecall_disassemble(void*)’:
Enclave/Enclave.cpp:161:17: warning: invalid conversion from ‘void*’ to ‘gb_state*’ [-fpermissive]
161 | disassemble(s);
| ^
| |
| void*
In file included from Enclave/Enclave.cpp:27:
Enclave/gbc/disassembler.h:10:35: note: initializing argument 1 of ‘void disassemble(gb_state*)’
10 | void disassemble(struct gb_state* state);
| ~~~~~~~~~~~~~~~~~^~~~~
Enclave/Enclave.cpp: In function ‘void ecall_audio_update(void*)’:
Enclave/Enclave.cpp:167:18: warning: invalid conversion from ‘void*’ to ‘gb_state*’ [-fpermissive]
167 | audio_update(s);
| ^
| |
| void*
In file included from Enclave/Enclave.cpp:26:
Enclave/gbc/audio.h:14:36: note: initializing argument 1 of ‘void audio_update(gb_state*)’
14 | void audio_update(struct gb_state *s);
```
clang++ reported many errors:
```bash
/usr/bin/clang++-8 -fpermissive -m64 -O3 -Wall -Winit-self -Wreturn-type -Wno-pointer-arith -Waddress -Wsequence-point -Wformat-security -Wmissing-include-dirs -Wundef -Wno-parentheses -Wcast-align -Wconversion -Wnon-virtual-dtor -std=c++11 -Wno-write-strings -nostdinc -fvisibility=hidden -fpie -fstack-protector -IEnclave -I/opt/sgxsdk/include -I/opt/sgxsdk/include/libcxx -I/opt/sgxsdk/include/tlibc -nostdinc++ -fpermissive -c Enclave/Enclave.cpp -o Enclave/Enclave.o -pedantic
In file included from Enclave/Enclave.cpp:1:
In file included from Enclave/Enclave_t.h:7:
In file included from /opt/sgxsdk/include/sgx_edger8r.h:46:
/opt/sgxsdk/include/sgx_defs.h:49:38: warning: named variadic macros are a GNU
extension [-Wvariadic-macros]
#define SGX_UBRIDGE(attr, fname, args...) attr fname args
^
In file included from Enclave/Enclave.cpp:1:
In file included from Enclave/Enclave_t.h:9:
Enclave/../Enclave/gbc/types.h:93:9: warning: anonymous types declared in an
anonymous union are an extension [-Wnested-anon-types]
struct {
^
Enclave/../Enclave/gbc/types.h:96:9: warning: anonymous types declared in an
anonymous union are an extension [-Wnested-anon-types]
struct { // little-endian of x86 is not nice here.
^
Enclave/../Enclave/gbc/types.h:99:9: warning: anonymous types declared in an
anonymous union are an extension [-Wnested-anon-types]
struct __attribute__((packed)) {
^
In file included from Enclave/Enclave.cpp:1:
In file included from Enclave/Enclave_t.h:12:
Enclave/../Enclave/sgx_includes.h:248:15: warning: zero size arrays are an
extension [-Wzero-length-array]
char data[0] __attribute__ ((aligned (__alignof__ (long double))));
^
Enclave/Enclave.cpp:57:34: warning: implicit conversion changes signedness:
'int' to 'size_t' (aka 'unsigned long') [-Wsign-conversion]
argv = (char **) calloc(argc + 5, sizeof(char **));
~~~~~~ ~~~~~^~~
Enclave/Enclave.cpp:90:10: error: assigning to 'struct player_input *' from
incompatible type 'void *'
ap = malloc(sizeof(struct player_input));
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Enclave/Enclave.cpp:92:9: error: assigning to 'uint16_t *'
(aka 'unsigned short *') from incompatible type 'void *'
b = malloc(23040 * 2);
^~~~~~~~~~~~~~~~~
Enclave/Enclave.cpp:161:5: error: no matching function for call to 'disassemble'
disassemble(s);
^~~~~~~~~~~
Enclave/gbc/disassembler.h:10:6: note: candidate function not viable: cannot
convert argument of incomplete type 'void *' to 'struct gb_state *' for
1st argument
void disassemble(struct gb_state* state);
^
Enclave/Enclave.cpp:167:5: error: no matching function for call to
'audio_update'
audio_update(s);
^~~~~~~~~~~~
Enclave/gbc/audio.h:14:6: note: candidate function not viable: cannot convert
argument of incomplete type 'void *' to 'struct gb_state *' for 1st
argument
void audio_update(struct gb_state *s);
^
6 warnings and 4 errors generated.
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJztW1lv27gW_jXKCyFDkhdZD3loEqc3QNEOZlr0vhm0RNucypQvSTlJf_09h5StJYotL8m0wBiqQ1Ncv7MfsrMseb5eOMENPOQxkz8UeWRp6nh3jvfBGXn2mVG1tFXbpu58zeSKK8U3jLir0YC4X_qEuN9pmsI3F1y7iqVzKEumcylc_byGlt9F5q4zLjSTLpVcL7FLkkimFJQU-1_ORMxsE6iYZ3JFcaQ4h8bPUGPmFAuXizjNE-YmXGLPXCRsTorxqWRCL5li-CamSrs05QuBPzKxYVLxTNi2wt1wqXOauonOJHGVTpz-XWw36ft2vEeYmsErCfPCiCKDVjA9YLDhis94CiuDXkueJEwgMhw2Oleaxj_ctcw0i83YDxNYMkW4HpzgP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