[cfe-commits] r51317 - in /cfe/trunk/lib/Headers: iso646.h stddef.h

Eli Friedman eli.friedman at gmail.com
Tue May 20 06:34:26 PDT 2008


Author: efriedma
Date: Tue May 20 08:34:26 2008
New Revision: 51317

URL: http://llvm.org/viewvc/llvm-project?rev=51317&view=rev
Log:
Add a couple more headers.  stddef was discussed on cfe-dev, and 
consensus was that it was fine; iso646 is trivial.

We actually don't need that many headers overall... on Ubuntu, at least, 
all we need are stdint.h, stdarg.h, limits.h, and float.h to stop 
depending on having gcc's headers around for normal code.

On a side note, the path searching needs some improvement; I had to 
hardcode the path to my header directory into clang.cpp to get the 
driver to use it consistently.


Added:
    cfe/trunk/lib/Headers/iso646.h
    cfe/trunk/lib/Headers/stddef.h

Added: cfe/trunk/lib/Headers/iso646.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/iso646.h?rev=51317&view=auto

==============================================================================
--- cfe/trunk/lib/Headers/iso646.h (added)
+++ cfe/trunk/lib/Headers/iso646.h Tue May 20 08:34:26 2008
@@ -0,0 +1,41 @@
+/*===---- iso646.h - Standard header for alternate spellings of operators---===
+ *
+ * Copyright (c) 2008 Eli Friedman
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ *===-----------------------------------------------------------------------===
+ */
+
+#ifndef __ISO646_H
+#define __ISO646_H
+
+#define and    &&
+#define and_eq &=
+#define bitand &
+#define bitor  |
+#define compl  ~
+#define not    !
+#define not_eq !=
+#define or     ||
+#define or_eq  |=
+#define xor    ^
+#define xor_eq ^=
+
+#endif /* __ISO646_H */

Added: cfe/trunk/lib/Headers/stddef.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/stddef.h?rev=51317&view=auto

==============================================================================
--- cfe/trunk/lib/Headers/stddef.h (added)
+++ cfe/trunk/lib/Headers/stddef.h Tue May 20 08:34:26 2008
@@ -0,0 +1,38 @@
+/*===---- stddef.h - Basic type definitions --------------------------------===
+ *
+ * Copyright (c) 2008 Eli Friedman
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ *===-----------------------------------------------------------------------===
+ */
+
+#ifndef __STDDEF_H
+#define __STDDEF_H
+
+typedef __typeof__(((int*)0)-((int*)0)) ptrdiff_t;
+typedef __typeof__(sizeof(int)) size_t;
+#ifndef __cplusplus
+typedef __typeof__(*L"") wchar_t;
+#endif
+
+#define NULL ((void*)0)
+#define offsetof(t, d) __builtin_offsetof(t, d)
+
+#endif /* __STDDEF_H */





More information about the cfe-commits mailing list