summaryrefslogtreecommitdiff
path: root/gcc/read-md.c
diff options
context:
space:
mode:
authorrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>2010-06-10 20:23:23 +0000
committerrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>2010-06-10 20:23:23 +0000
commit664c5888764faa174b1b21c3b23b3f575bfc1355 (patch)
treeb0d555e6cf1ab4460355eb3d51bbf23067aaef5f /gcc/read-md.c
parent77ba95d053c5a5a5189cab0526a223ff1f1f4b37 (diff)
downloadgcc-664c5888764faa174b1b21c3b23b3f575bfc1355.tar.gz
gcc/
* Makefile.in (BUILD_RTL): Move build/read-md.o to... (BUILD_MD): ...this new variable. (simple_generated_rtl_h, simple_generated_rtl_c): New variables that include the old contents of simple_generated_h and simple_generated_c. (simple_generated_h, simple_generated_c): Include them. Add insn-constants.h. (s-%): Make simple_generated_{h,c} stamps depend on $(MD_DEPS) and simple_generated_rtl_{h,c} stamps depend on insn-conditions.md. Remove these dependencies from the main rule and include insn-conditions.md in the command line only if it appears in the dependency list. (insn-constants.h, s-constants): Delete. (build/genconstants.o): Don't depend on $(RTL_BASE_H), $(GTM_H) or gensupport.h. (build/genmddeps.o): Likewise. (genprogrtl): New variable that contains everything from genprogmd except mddeps and constants. (genprogmd): Redefine in terms of genprogrtl. Make these programs depend on $(BUILD_MD) (genprog): New variable. Make these programs depend on $(BUILD_ERRORS). * genmddeps.c: Don't include tm.h, rtl.h or gensupport.h. (main): Use read_md_files instead of init_rtx_reader_args. * genconstants.c: As for genmddeps.c. * read-md.h (read_skip_construct): Declare. * read-md.c (read_skip_construct): New function. (handle_file): Allow a null handle_directive, skipping the construct if so. (parse_include): Update the comment accordingly. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@160578 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/read-md.c')
-rw-r--r--gcc/read-md.c56
1 files changed, 54 insertions, 2 deletions
diff --git a/gcc/read-md.c b/gcc/read-md.c
index 0071e28b471..af9800f8e2d 100644
--- a/gcc/read-md.c
+++ b/gcc/read-md.c
@@ -575,6 +575,55 @@ read_string (int star_if_braced)
return stringbuf;
}
+/* Skip the rest of a construct that started at line LINENO and that
+ is currently nested by DEPTH levels of parentheses. */
+
+void
+read_skip_construct (int depth, int lineno)
+{
+ struct md_name name;
+ int c;
+
+ do
+ {
+ c = read_skip_spaces ();
+ if (c == EOF)
+ {
+ error_with_line (lineno, "unterminated construct");
+ exit (1);
+ }
+ switch (c)
+ {
+ case '(':
+ depth++;
+ break;
+
+ case ')':
+ depth--;
+ break;
+
+ case ':':
+ case '[':
+ case ']':
+ case '/':
+ break;
+
+ case '\"':
+ case '{':
+ unread_char (c);
+ read_string (false);
+ break;
+
+ default:
+ unread_char (c);
+ read_name (&name);
+ break;
+ }
+ }
+ while (depth > 0);
+ unread_char (c);
+}
+
/* Given a string, return the number of comma-separated elements in it.
Return 0 for the null string. */
@@ -787,8 +836,10 @@ handle_file (directive_handler_t handle_directive)
handle_constants ();
else if (strcmp (directive.string, "include") == 0)
handle_include (lineno, handle_directive);
- else
+ else if (handle_directive)
handle_directive (lineno, directive.string);
+ else
+ read_skip_construct (1, lineno);
c = read_skip_spaces ();
if (c != ')')
@@ -840,7 +891,8 @@ parse_include (const char *arg)
It should return true if it recognizes the argument or false if a
generic error should be reported.
- The parser calls HANDLE_DIRECTIVE for each unknown directive.
+ If HANDLE_DIRECTIVE is nonnull, the parser calls it for each
+ unknown directive, otherwise it just skips such directives.
See the comment above the directive_handler_t definition for
details about the callback's interface. */