[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Lost] [Patch] stdarg.h ersetzen



Dieser Patch ersetzt die bisherige stdarg.h in src/modules/include durch
eine in src/include, da ich diese auch in kernel2 benutzen möchte.
Weiter werden bei der neuen die builtin-Definitionen verwendet. Dies
sorgt zwar dafür, dass es nur noch  mit gcc funktioniert, aber das ist
ja sowieso schon der Fall. Ein weiterer Vorteil dieser Definitionen ist,
dass sie garantiert zur aktuellen Plattform passen, nicht wie die aktuellen.
Index: src/include/stdarg.h
===================================================================
--- src/include/stdarg.h	(Revision 0)
+++ src/include/stdarg.h	(Revision 0)
@@ -0,0 +1,49 @@
+ /*
+ * Copyright (c) 2007 The LOST Project. All rights reserved.
+ *
+ * This code is derived from software contributed to the LOST Project
+ * by Antoine Kaufmann.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *     This product includes software developed by the LOST Project
+ *     and its contributors.
+ * 4. Neither the name of the LOST Project nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _STDARG_H_
+#define _STDARG_H_
+
+// Alle diese Definitionen funktionieren vermutlich nur mit gcc ;-)
+typedef __builtin_va_list va_list;
+
+#define va_start(v, l)  __builtin_va_start(v,l)
+#define va_end(v)       __builtin_va_end(v)
+#define va_arg(v, l)    __builtin_va_arg(v,l)
+#define va_copy(d, s)   __builtin_va_copy(d,s)
+
+
+#endif //ifndef _STDARG_H_
+
Index: src/modules/include/stdarg.h
===================================================================
--- src/modules/include/stdarg.h	(Revision 589)
+++ src/modules/include/stdarg.h	(Arbeitskopie)
@@ -1,17 +0,0 @@
-#ifndef _STDARG_H
-#define _STDARG_H
-
-typedef char * va_list;
-
-// gibt die Größe des Typs type aufgerundet auf das nächste Vielfache von sizeof(int) zurück.
-#define _va_rounded_size(type) (((sizeof(type) + sizeof(int) - 1) / sizeof(int)) * sizeof(int))
-
-#define va_start(ap, f) ( ap = (va_list)&f + sizeof(int) )
-#define va_arg(ap, type) (*(type*)((ap += _va_rounded_size(type)) - _va_rounded_size(type)))
-#define va_end(ap)
-
-#ifndef _VA_LIST
-#define _VA_LIST va_list
-#endif /* ndef _VA_LIST */
-
-#endif /* ndef _STDARG_H */