diff options
author | Alexandre Oliva <aoliva@redhat.com> | 2007-03-09 23:25:59 +0000 |
---|---|---|
committer | Alexandre Oliva <aoliva@redhat.com> | 2007-03-09 23:25:59 +0000 |
commit | e9fc6c21007f3530d73cc4ba4983dc9f118af219 (patch) | |
tree | b575273e42a88f1083c7e074e5d93b83a0ce02a8 /gas/read.c | |
parent | 6f74c397defce90b9323316d756b32d9373b874c (diff) | |
download | gdb-e9fc6c21007f3530d73cc4ba4983dc9f118af219.zip gdb-e9fc6c21007f3530d73cc4ba4983dc9f118af219.tar.gz gdb-e9fc6c21007f3530d73cc4ba4983dc9f118af219.tar.bz2 |
* app.c (do_scrub_chars): Recognize comments after # line "file".
* read.c (get_linefile_number): New.
(s_app_line): Accept ill-formed .linefile lines as comments.
Diffstat (limited to 'gas/read.c')
-rw-r--r-- | gas/read.c | 49 |
1 files changed, 41 insertions, 8 deletions
@@ -1698,6 +1698,19 @@ s_app_file (int appfile) } } +static int +get_linefile_number (int *flag) +{ + SKIP_WHITESPACE (); + + if (*input_line_pointer < '0' || *input_line_pointer > '9') + return 0; + + *flag = get_absolute_expression (); + + return 1; +} + /* Handle the .appline pseudo-op. This is automatically generated by do_scrub_chars when a preprocessor # line comment is seen. This default definition may be overridden by the object or CPU specific @@ -1706,10 +1719,19 @@ s_app_file (int appfile) void s_app_line (int appline) { + char *file = NULL; int l; /* The given number is that of the next line. */ - l = get_absolute_expression () - 1; + if (appline) + l = get_absolute_expression (); + else if (!get_linefile_number (&l)) + { + ignore_rest_of_line (); + return; + } + + l--; if (l < -1) /* Some of the back ends can't deal with non-positive line numbers. @@ -1726,18 +1748,20 @@ s_app_line (int appline) else { int flags = 0; - char *file = NULL; int length = 0; if (!appline) { - file = demand_copy_string (&length); + SKIP_WHITESPACE (); + + if (*input_line_pointer == '"') + file = demand_copy_string (&length); if (file) { int this_flag; - while ((this_flag = get_absolute_expression ())) + while (get_linefile_number (&this_flag)) switch (this_flag) { /* From GCC's cpp documentation: @@ -1772,16 +1796,25 @@ s_app_line (int appline) this_flag); break; } + + if (!is_end_of_line[(unsigned char)*input_line_pointer]) + file = 0; } } - new_logical_line_flags (file, l, flags); + if (appline || file) + { + new_logical_line_flags (file, l, flags); #ifdef LISTING - if (listing) - listing_source_line (l); + if (listing) + listing_source_line (l); #endif + } } - demand_empty_rest_of_line (); + if (appline || file) + demand_empty_rest_of_line (); + else + ignore_rest_of_line (); } /* Handle the .end pseudo-op. Actually, the real work is done in |