comparison cpudetect.c @ 28364:3e3bd9da4c7e

Use OS preprocessor checks with '#if defined()' consistently. Avoids undefined preprocessor directives warnings.
author diego
date Fri, 30 Jan 2009 23:29:39 +0000
parents 457eb94aaf59
children 6629e391d52d
comparison
equal deleted inserted replaced
28363:7baa7292f575 28364:3e3bd9da4c7e
16 16
17 #if defined (__NetBSD__) || defined(__OpenBSD__) 17 #if defined (__NetBSD__) || defined(__OpenBSD__)
18 #include <sys/param.h> 18 #include <sys/param.h>
19 #include <sys/sysctl.h> 19 #include <sys/sysctl.h>
20 #include <machine/cpu.h> 20 #include <machine/cpu.h>
21 #endif 21 #elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) || defined(__APPLE__)
22
23 #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) || defined(__APPLE__)
24 #include <sys/types.h> 22 #include <sys/types.h>
25 #include <sys/sysctl.h> 23 #include <sys/sysctl.h>
26 #endif 24 #elif defined(__linux__)
27
28 #ifdef __linux__
29 #include <signal.h> 25 #include <signal.h>
30 #endif 26 #elif defined(__MINGW32__) || defined(__CYGWIN__)
31
32 #if defined(__MINGW32__) || defined(__CYGWIN__)
33 #include <windows.h> 27 #include <windows.h>
34 #endif 28 #elif defined(__OS2__)
35
36 #ifdef __OS2__
37 #define INCL_DOS 29 #define INCL_DOS
38 #include <os2.h> 30 #include <os2.h>
39 #endif 31 #elif defined(__AMIGAOS4__)
40
41 #ifdef __AMIGAOS4__
42 #include <proto/exec.h> 32 #include <proto/exec.h>
43 #endif 33 #endif
44 34
45 /* Thanks to the FreeBSD project for some of this cpuid code, and 35 /* Thanks to the FreeBSD project for some of this cpuid code, and
46 * help understanding how to use it. Thanks to the Mesa 36 * help understanding how to use it. Thanks to the Mesa
473 } 463 }
474 #else /* ARCH_X86 */ 464 #else /* ARCH_X86 */
475 465
476 #ifdef __APPLE__ 466 #ifdef __APPLE__
477 #include <sys/sysctl.h> 467 #include <sys/sysctl.h>
478 #elif __AMIGAOS4__ 468 #elif defined(__AMIGAOS4__)
479 /* nothing */ 469 /* nothing */
480 #else 470 #else
481 #include <signal.h> 471 #include <signal.h>
482 #include <setjmp.h> 472 #include <setjmp.h>
483 473
527 517
528 if (err == 0) 518 if (err == 0)
529 if (has_vu != 0) 519 if (has_vu != 0)
530 caps->hasAltiVec = 1; 520 caps->hasAltiVec = 1;
531 } 521 }
532 #elif __AMIGAOS4__ 522 #elif defined(__AMIGAOS4__)
533 ULONG result = 0; 523 ULONG result = 0;
534 524
535 GetCPUInfoTags(GCIT_VectorUnit, &result, TAG_DONE); 525 GetCPUInfoTags(GCIT_VectorUnit, &result, TAG_DONE);
536 if (result == VECTORTYPE_ALTIVEC) 526 if (result == VECTORTYPE_ALTIVEC)
537 caps->hasAltiVec = 1; 527 caps->hasAltiVec = 1;