source: rtems/cpukit/aclocal/gcc-sanity.m4 @ b3950931

4.104.11
Last change on this file since b3950931 was b3950931, checked in by Ralf Corsepius <ralf.corsepius@…>, on Apr 13, 2010 at 4:23:26 AM

Add RTEMS_CHECK_GCC_PRINTF_LD_OFF_T, RTEMS_CHECK_GCC_PRINTF_LLD_OFF_T.

  • Property mode set to 100644
File size: 2.5 KB
Line 
1# Some GCC sanity checks to check for known bugs in the rtems gcc toolchains
2
3# Internal macro
4# _RTEMS_GCC_WARNING(msg,cache-variable,include,main)
5AC_DEFUN([_RTEMS_GCC_WARNING],[
6  AC_CACHE_CHECK([$1],
7    [$2],[
8    AS_IF([test x"$GCC" = xyes],[
9      save_CFLAGS=$CFLAGS
10      CFLAGS="-Wall -Werror"])
11
12    AC_COMPILE_IFELSE([
13      AC_LANG_PROGRAM([$3],[$4])],
14      [$2=yes],
15      [$2=no])
16
17    AS_IF([test x"$GCC" = xyes],[
18      CFLAGS=$save_CFLAGS])
19  ])
20])
21
22AC_DEFUN([RTEMS_CHECK_GCC_PRIxPTR],[
23  _RTEMS_GCC_WARNING(
24    [if printf("%" PRIxPTR, uintptr_t) works],
25    [rtems_cv_PRIxPTR],[
26      #include <inttypes.h>
27      #include <stdio.h>
28    ],[
29      uintptr_t ptr = 42;
30      printf("%" PRIxPTR "\n", ptr);
31    ])
32])
33
34AC_DEFUN([RTEMS_CHECK_GCC_PRIuPTR],[
35  _RTEMS_GCC_WARNING(
36    [if printf("%" PRIuPTR, uintptr_t) works],
37    [rtems_cv_PRIuPTR],[
38      #include <inttypes.h>
39      #include <stdio.h>
40    ],[
41      uintptr_t ptr = 42;
42      printf("%" PRIuPTR "\n", ptr);
43    ])
44])
45
46AC_DEFUN([RTEMS_CHECK_GCC_PRIdPTR],[
47  _RTEMS_GCC_WARNING(
48    [if printf("%" PRIdPTR, intptr_t) works],
49    [rtems_cv_PRIdPTR],[
50      #include <inttypes.h>
51      #include <stdio.h>
52    ],[
53      intptr_t ptr = -1;
54      printf("%" PRIdPTR "\n", ptr);
55    ])
56])
57
58AC_DEFUN([RTEMS_CHECK_GCC_PRINTF_ZU_SIZE_T],[
59  _RTEMS_GCC_WARNING(
60    [if printf("%zu", size_t) works],
61    [rtems_cv_PRINTF_ZU_SIZE_T],[
62      #include <sys/types.h>
63      #include <stdio.h>
64    ],[
65      size_t sz = 1;
66      printf("%zu\n", sz);
67    ])
68])
69
70AC_DEFUN([RTEMS_CHECK_GCC_PRINTF_ZD_SSIZE_T],[
71  _RTEMS_GCC_WARNING(
72    [if printf("%zd", ssize_t) works],
73    [rtems_cv_PRINTF_ZD_SSIZE_T],[
74      #include <sys/types.h>
75      #include <stdio.h>
76    ],[
77      ssize_t sz = 1;
78      printf("%zd\n", sz);
79    ])
80])
81
82AC_DEFUN([RTEMS_CHECK_GCC_PRINTF_LD_OFF_T],[
83  _RTEMS_GCC_WARNING(
84    [if printf("%ld", off_t) works],
85    [rtems_cv_PRINTF_LD_OFF_T],[
86       #include <sys/types.h>
87       #include <stdio.h>
88    ],[
89      off_t off = 1;
90      printf("%ld\n", off);
91    ])
92])
93
94AC_DEFUN([RTEMS_CHECK_GCC_PRINTF_LLD_OFF_T],[
95  _RTEMS_GCC_WARNING(
96    [if printf("%lld", off_t) works],
97    [rtems_cv_PRINTF_LLD_OFF_T],[
98       #include <sys/types.h>
99       #include <stdio.h>
100    ],[
101      off_t off = 1;
102      printf("%lld\n", off);
103    ])
104])
105
106AC_DEFUN([RTEMS_CHECK_GCC_SANITY],[
107RTEMS_CHECK_GCC_PRIxPTR
108RTEMS_CHECK_GCC_PRIuPTR
109RTEMS_CHECK_GCC_PRIdPTR
110RTEMS_CHECK_GCC_PRINTF_ZU_SIZE_T
111RTEMS_CHECK_GCC_PRINTF_ZD_SSIZE_T
112RTEMS_CHECK_GCC_PRINTF_LD_OFF_T
113RTEMS_CHECK_GCC_PRINTF_LLD_OFF_T
114])
Note: See TracBrowser for help on using the repository browser.