Fix warnings that have become errors with GCC 14

This commit is contained in:
Felix Morgner 2024-05-10 00:25:35 +02:00 committed by Ryan Kurtz
parent c6bf1f3e12
commit fb29ad360f
4 changed files with 7 additions and 3 deletions

View file

@ -15,6 +15,7 @@
*/ */
#include <pthread.h> #include <pthread.h>
#include <stdio.h> #include <stdio.h>
#include <unistd.h>
pthread_t thread; pthread_t thread;

View file

@ -14,6 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
#include <stdio.h> #include <stdio.h>
#include <unistd.h>
int func(int id) { int func(int id) {
if (id) { if (id) {

View file

@ -15,6 +15,8 @@
*/ */
#ifdef WIN32 #ifdef WIN32
#include <Windows.h> #include <Windows.h>
#else
#include <unistd.h>
#endif #endif
#ifdef WIN32 #ifdef WIN32

View file

@ -38,7 +38,7 @@ typedef enum _myenum {
typedef void (*myfunc_p)(int arg0, long arg1); typedef void (*myfunc_p)(int arg0, long arg1);
typedef void (*myvargfunc_p)(int arg0, long arg1, ...); typedef void (*myvargfunc_p)(int arg0, long arg1, ...);
typedef myundef; typedef int myundef; // forbidding to be "undefined" in C99 and later
int int_var; int int_var;
void* void_p_var; void* void_p_var;
@ -86,11 +86,11 @@ int main(int argc, char** argv) {
printf("complex: %d\n", sizeof(complex_var)); printf("complex: %d\n", sizeof(complex_var));
printf("double complex: %d\n", sizeof(double_complex_var)); printf("double complex: %d\n", sizeof(double_complex_var));
register mycomplex_p cparts = &complex_var; register mycomplex_p cparts = (mycomplex_p)&complex_var;
printf("single real: %f\n", cparts->real); printf("single real: %f\n", cparts->real);
printf("single imag: %f\n", cparts->imag); printf("single imag: %f\n", cparts->imag);
mydoublex_p dparts = &double_complex_var; mydoublex_p dparts = (mydoublex_p)&double_complex_var;
printf("double real: %g\n", dparts->real); printf("double real: %g\n", dparts->real);
printf("double imag: %g\n", dparts->imag); printf("double imag: %g\n", dparts->imag);