* device/include/hc08/mc68hc908jkjl.h: committed fix for bug #1929739, thanks Alejand...
[fw/sdcc] / support / cpp2 / c-ppoutput.c
index 9a5434311ae6d9dbc2169cd97e1a546b64a01ef2..908558354adc9ee699ce8062800c945b5dc8d922 100644 (file)
@@ -245,7 +245,8 @@ print_line (source_location src_loc, const char *special_flags)
       const struct line_map *map = linemap_lookup (&line_table, src_loc);
 
       size_t to_file_len = strlen (map->to_file);
-      unsigned char *to_file_quoted = alloca (to_file_len * 4 + 1);
+      unsigned char *to_file_quoted =
+         (unsigned char *) alloca (to_file_len * 4 + 1);
       unsigned char *p;
 
       print.src_line = SOURCE_LINE (map, src_loc);
@@ -322,7 +323,8 @@ cb_define (cpp_reader *pfile, source_location line, cpp_hashnode *node)
     fputs ((const char *) NODE_NAME (node), print.outf);
 
   putc ('\n', print.outf);
-  print.src_line++;
+  if (linemap_lookup (&line_table, line)->to_line != 0)
+    print.src_line++;
 }
 
 static void
@@ -367,7 +369,8 @@ void
 pp_dir_change (cpp_reader *pfile ATTRIBUTE_UNUSED, const char *dir)
 {
   size_t to_file_len = strlen (dir);
-  unsigned char *to_file_quoted = alloca (to_file_len * 4 + 1);
+  unsigned char *to_file_quoted =
+     (unsigned char *) alloca (to_file_len * 4 + 1);
   unsigned char *p;
 
   /* cpp_quote_string does not nul-terminate, so we have to do it ourselves.  */
@@ -453,4 +456,4 @@ cb_read_pch (cpp_reader *pfile, const char *name,
   fprintf (print.outf, "#pragma GCC pch_preprocess \"%s\"\n", name);
   print.src_line++;
 }
-#endif
\ No newline at end of file
+#endif