[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [MiNT] osbind.S ?
Frank Naumann wrote:
The new syscall stuff was intended to replace the manual written
bindings. It was almost finished from my side.
Frank, today you enabled the syscall generator, but the generated sources
don't compile with GCC 4.x.
The attached patch fixes the GCC 4.x compilation again, plus some additional
cleanup in compiler macros.
Please commit.
--
Vincent Rivière
diff -aurN -x CVS mintlib.orig/ChangeLog mintlib.syscall/ChangeLog
--- mintlib.orig/ChangeLog 2009-05-18 22:31:48.796875000 +0200
+++ mintlib.syscall/ChangeLog 2009-05-22 16:19:01.843750000 +0200
@@ -1,3 +1,11 @@
+2009-05-22 Friday 16:17 Vincent Riviere <vincent.riviere@freesbee.fr>
+
+ * include/compiler.h, include/features.h.in, include/mint/mintbind.h,
+ include/mint/osbind.h, syscall/traps.c
+
+ Fixed the syscall generator for GCC >= 3 by using __CLOBBER_RETURN.
+ Moved the macros __GNUC_PREREQ and AND_MEMORY to compiler.h
+
2009-05-18 Monday 20:51 Vincent Riviere <vincent.riviere@freesbee.fr>
* mintlib/include/compiler.h, mintlib/include/macros.h,
diff -aurN -x CVS mintlib.orig/include/compiler.h mintlib.syscall/include/compiler.h
--- mintlib.orig/include/compiler.h 2009-05-18 22:31:49.234375000 +0200
+++ mintlib.syscall/include/compiler.h 2009-05-22 15:36:07.078125000 +0200
@@ -12,6 +12,20 @@
# define __MINT__
#endif
+/* Convenience macros to test the versions of glibc and gcc.
+ Use them like this:
+ #if __GNUC_PREREQ (2,8)
+ ... code requiring gcc 2.8 or later ...
+ #endif
+ Note - they won't work for gcc1 or glibc1, since the _MINOR macros
+ were not defined then. */
+#if defined __GNUC__ && defined __GNUC_MINOR__
+# define __GNUC_PREREQ(maj, min) \
+ ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
+#else
+# define __GNUC_PREREQ(maj, min) 0
+#endif
+
/* symbols to identify the type of compiler */
/* general library stuff */
@@ -44,8 +58,7 @@
#define __WCHAR_TYPEDEF__ __WCHAR_TYPE__
#endif
-#if (__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 5))
-/* false for gcc < 2.5 */
+#if __GNUC_PREREQ(2, 5)
#define __NORETURN __attribute__ ((noreturn))
#define __EXITING void
#else
@@ -56,12 +69,18 @@
# define __GNUC_INLINE__
#endif
-#if ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ == 4)
+#if __GNUC_PREREQ(3, 3)
# define __CLOBBER_RETURN(a)
#else
# define __CLOBBER_RETURN(a) a,
#endif
+#if __GNUC_PREREQ(2, 6)
+#define AND_MEMORY , "memory"
+#else
+#define AND_MEMORY
+#endif
+
#ifdef __mcoldfire__
#define PUSH_SP(regs,size) \
diff -aurN -x CVS mintlib.orig/include/features.h.in mintlib.syscall/include/features.h.in
--- mintlib.orig/include/features.h.in 2008-06-27 15:59:26.000000000 +0200
+++ mintlib.syscall/include/features.h.in 2009-05-22 15:30:27.531250000 +0200
@@ -122,21 +122,6 @@
/* Always use ISO C things. */
#define __USE_ANSI 1
-/* Convenience macros to test the versions of glibc and gcc.
- Use them like this:
- #if __GNUC_PREREQ (2,8)
- ... code requiring gcc 2.8 or later ...
- #endif
- Note - they won't work for gcc1 or glibc1, since the _MINOR macros
- were not defined then. */
-#if defined __GNUC__ && defined __GNUC_MINOR__
-# define __GNUC_PREREQ(maj, min) \
- ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
-#else
-# define __GNUC_PREREQ(maj, min) 0
-#endif
-
-
/* If _BSD_SOURCE was defined by the user, favor BSD over POSIX. */
#if defined _BSD_SOURCE && \
!(defined _POSIX_SOURCE || defined _POSIX_C_SOURCE || \
diff -aurN -x CVS mintlib.orig/include/mint/mintbind.h mintlib.syscall/include/mint/mintbind.h
--- mintlib.orig/include/mint/mintbind.h 2009-05-18 20:54:50.562500000 +0200
+++ mintlib.syscall/include/mint/mintbind.h 2009-05-22 15:41:35.828125000 +0200
@@ -12,7 +12,7 @@
__BEGIN_DECLS
-/* see osbind.h for __extension__ and AND_MEMORY */
+/* see compiler.h for __extension__ and AND_MEMORY */
#define trap_1_wllw(n, a, b, c) \
__extension__ \
diff -aurN -x CVS mintlib.orig/include/mint/osbind.h mintlib.syscall/include/mint/osbind.h
--- mintlib.orig/include/mint/osbind.h 2009-05-18 20:54:50.562500000 +0200
+++ mintlib.syscall/include/mint/osbind.h 2009-05-22 15:39:22.906250000 +0200
@@ -124,13 +124,6 @@
*
*/
-#if __GNUC__ > 2 || __GNUC_MINOR__ > 5
-#define AND_MEMORY , "memory"
-#else
-#define AND_MEMORY
-#define __extension__
-#endif
-
#define trap_1_w(n) \
__extension__ \
({ \
diff -aurN -x CVS mintlib.orig/syscall/traps.c mintlib.syscall/syscall/traps.c
--- mintlib.orig/syscall/traps.c 2009-05-18 20:54:50.718750000 +0200
+++ mintlib.syscall/syscall/traps.c 2009-05-22 16:04:08.000000000 +0200
@@ -86,15 +86,6 @@
int len = strlen(call);
int i;
- fprintf(out, "\n");
- fprintf(out, "#if __GNUC__ > 2 || __GNUC_MINOR__ > 5\n");
- fprintf(out, "#define AND_MEMORY , \"memory\"\n");
- fprintf(out, "#else\n");
- fprintf(out, "#define AND_MEMORY\n");
-// fprintf(out, "#define __extension__\n");
- fprintf(out, "#endif\n");
- fprintf(out, "\n");
-
fprintf(out, "long\n");
fprintf(out, "__trap_%i_w%s(short n", nr, call);
@@ -159,7 +150,7 @@
i++;
}
fprintf(out, "\n");
- fprintf(out, "\t: \"d0\", \"d1\", \"d2\", \"a0\", \"a1\", \"a2\" /* clobbered regs */\n");
+ fprintf(out, "\t: __CLOBBER_RETURN(\"d0\") \"d1\", \"d2\", \"a0\", \"a1\", \"a2\" /* clobbered regs */\n");
fprintf(out, "\t AND_MEMORY\n");
fprintf(out, "\t);\n");
fprintf(out, "\t\n");
@@ -204,6 +195,7 @@
print_head(f, "gen-syscall");
fprintf(f, "#include <mint/trap.h>\n");
+ fprintf(f, "#include <compiler.h>\n");
fprintf(f, "\n");
generate_trap_impl(f, l->nr, l->call);