mirror of
https://github.com/autc04/Retro68.git
synced 2024-10-05 04:55:29 +00:00
8f68ffd203
Specify parameters for all C functions. Not specifying parameters is the same as specifying "void" in C++ and in C23 and later but that's not the case in C prior to C23. Compile C files with the same warnings as C++ files, additionally making the strict prototypes warning an error to catch such problems in the future. This commit isn't intended to address all the other warnings now being emitted.
30 lines
474 B
C
30 lines
474 B
C
#include "Test.h"
|
|
#include <stdlib.h>
|
|
|
|
__attribute__((noinline)) static void* foo(size_t x)
|
|
{
|
|
return malloc(x);
|
|
}
|
|
|
|
int main(void)
|
|
{
|
|
if(*(short*)&foo != 0x60FF)
|
|
{
|
|
TEST_LOG_NO();
|
|
return 0;
|
|
}
|
|
|
|
uint32_t offset = *(uint32_t*) ((char*)&foo + 2);
|
|
if(((char*)&foo + 2) + offset != (char*)&malloc)
|
|
{
|
|
TEST_LOG_NO();
|
|
return 0;
|
|
}
|
|
|
|
char *p = foo(42);
|
|
strcpy(p, "OK");
|
|
TestLog(p);
|
|
free(p);
|
|
return 0;
|
|
}
|