Author: brent
Date: Thu Oct 27 15:19:55 2005
New Revision: 10298
Modified:
branches/GD_2_4/src/tools/melange/c-lexer-cpp.dylan
branches/GD_2_4/src/tools/melange/c-parse.input
branches/GD_2_4/src/tools/melange/macos-portability.dylan
Log:
Job: 7267
Handle parsing of macro definitions involving empty argument lists.
Correct handling of Mac OS X 10.4.2 header files.
Modified: branches/GD_2_4/src/tools/melange/c-lexer-cpp.dylan
==============================================================================
--- branches/GD_2_4/src/tools/melange/c-lexer-cpp.dylan (original)
+++ branches/GD_2_4/src/tools/melange/c-lexer-cpp.dylan Thu Oct 27 15:19:55 2005
@@ -745,7 +745,7 @@
if (*show-parse-progress-level* > $parse-progress-level-none)
let defn = state.cpp-table[name.string-value];
let (args, expansion) =
- if (instance?(defn.head, <pair>))
+ if (defn ~== #() & instance?(defn.head, <list>))
values(defn.head.reverse, defn.tail.reverse)
else
values(#f, defn.reverse)
Modified: branches/GD_2_4/src/tools/melange/c-parse.input
==============================================================================
--- branches/GD_2_4/src/tools/melange/c-parse.input (original)
+++ branches/GD_2_4/src/tools/melange/c-parse.input Thu Oct 27 15:19:55 2005
@@ -398,27 +398,37 @@
//
if (~instance?(@0, <parse-cpp-state>) | %1.string-value ~= "defined")
let definition = element(%1.generator.cpp-table, %1.string-value,
- default: #f);
+ default: #f);
if (definition ~= #f)
if (instance?(definition.head, <token>))
- parse-error(@0,concatenate(%1.string-value, " isn't a parameterized
macro."));
+ parse-error(@0,concatenate(%1.string-value, " isn't a parameterized
macro."));
else
- // XXX: We don't actually substitute here like we should, but
- // it'll handle "#define __GNUC_PREREQ(maj,min) 0" correctly...
-// for (token in definition.tail)
-/* for (count from 0, param in definition.head)
- if (token.string-value = param.string-value)
- token := %3[count];
- end if;
- end for;
+ // XXX: We don't actually substitute here like we should, but
+ // it'll handle "#define __GNUC_PREREQ(maj,min) 0" correctly...
+// for (token in definition.tail)
+/* for (count from 0, param in definition.head)
+ if (token.string-value = param.string-value)
+ token := %3[count];
+ end if;
+ end for;
*/
-// unget-token(%1.generator, token);
-// end for;
-// cpp-parse(%1.generator);
+// unget-token(%1.generator, token);
+// end for;
+// cpp-parse(%1.generator);
0; // yeah, chickening out.
end if;
else
- parse-error(@0,"Function calls not allowed in constant expressions.");
+ if ( %1.string-value = "defined" )
+ if (~instance?(%3, <token>))
+ %3; // It's a literal
+ elseif (element(%3.generator.cpp-table, %3.string-value, default: #f))
+ 1;
+ else
+ 0
+ end if
+ else
+ parse-error(@0,"Function calls not allowed in constant expressions.");
+ end if;
end if;
elseif (element(%3.generator.cpp-table, %3.string-value, default: #f))
1;
Modified: branches/GD_2_4/src/tools/melange/macos-portability.dylan
==============================================================================
--- branches/GD_2_4/src/tools/melange/macos-portability.dylan (original)
+++ branches/GD_2_4/src/tools/melange/macos-portability.dylan Thu Oct 27
15:19:55 2005
@@ -48,38 +48,41 @@
// Basics
"const", "",
"volatile", "",
+ "__STDC__", "",
+
//"__cdecl", "",
-
// cpp -dM /dev/null
- "GNUC", "(1)",
-
+ //"GNUC", "(1)",
// cc -E -dM -o - /dev/null
- "__GNUC__", "2",
- "__GNUC_MINOR__", "95",
+ "__GNUC__", "4",
+ "__GNUC_MINOR__", "0",
+
+ "__APPLE__", "",
"__ppc__", "",
"__NATURAL_ALIGNMENT__", "",
"__MACH__", "",
"__BIG_ENDIAN__", "",
- "__APPLE__", "",
- "__STDC__", "",
- "__APPLE_CC__", "934",
+ "__APPLE_CC__", "5026",
"__DYNAMIC__", "",
"__signed__", "",
"__signed", "",
"__inline__", "",
"__inline", "",
+ "__STDC_VERSION__", "199901L",
+ "__builtin_va_list", "void*",
// Parameterized macros which remove various GCC extensions from our
// source code. The last item in the list is the right-hand side of
// the define; all the items preceding it are named parameters.
- "__attribute__", #(#("x"), "")
+ "__attribute__", #(#("x"), ""),
+ "__asm", #(#("x"), "")
];
// Set up the search path for .h files
// cc -E -v /dev/null
define constant macos-include-directories
= #["/usr/local/include",
- "/usr/include/gcc/darwin/2.95.2/g++/..",
+ "/usr/include/gcc/darwin/default/c++/..",
"/usr/include"];
for (dir in macos-include-directories)
--
Gd-chatter mailing list
Gd-chatter@xxxxxxxxxxxxxxxx
https://gauss.gwydiondylan.org/mailman/listinfo/gd-chatter
|