summaryrefslogtreecommitdiff
path: root/srcpos.h
diff options
context:
space:
mode:
authorJon Loeliger <jdl@jdl.com>2008-09-12 13:39:49 -0500
committerJon Loeliger <jdl@jdl.com>2008-10-03 15:38:08 -0500
commite5c8e1dcd7f2d3784194498e5ea916e7b48fe33a (patch)
treee764fa389f36895c055744b4be39de1c3127bdf3 /srcpos.h
parent83ac55d9c4669397f3f2454d3c72dd34e5de5490 (diff)
downloaddtc-e5c8e1dcd7f2d3784194498e5ea916e7b48fe33a.tar.gz
Enhance source position implementation.
Implemented some print and copy routines. Made empty srcpos objects that will be used later. Protected .h file from multiple #include's. Added srcpos_error() and srcpos_warn(). Signed-off-by: Jon Loeliger <jdl@freescale.com>
Diffstat (limited to 'srcpos.h')
-rw-r--r--srcpos.h23
1 files changed, 21 insertions, 2 deletions
diff --git a/srcpos.h b/srcpos.h
index e17c7c0..a6d0077 100644
--- a/srcpos.h
+++ b/srcpos.h
@@ -17,6 +17,9 @@
* USA
*/
+#ifndef _SRCPOS_H_
+#define _SRCPOS_H_
+
/*
* Augment the standard YYLTYPE with a filenum index into an
* array of all opened filenames.
@@ -69,9 +72,14 @@ typedef struct YYLTYPE {
while (YYID (0))
+typedef YYLTYPE srcpos;
-extern void yyerror(char const *);
-extern void yyerrorf(char const *, ...) __attribute__((format(printf, 1, 2)));
+/*
+ * Fictional source position used for IR nodes that are
+ * created without otherwise knowing a true source position.
+ * For example,constant definitions from the command line.
+ */
+extern srcpos srcpos_empty;
extern struct dtc_file *srcpos_file;
@@ -83,3 +91,14 @@ struct search_path {
extern struct dtc_file *dtc_open_file(const char *fname,
const struct search_path *search);
extern void dtc_close_file(struct dtc_file *file);
+
+extern srcpos *srcpos_copy(srcpos *pos);
+extern char *srcpos_string(srcpos *pos);
+extern void srcpos_dump(srcpos *pos);
+
+extern void srcpos_error(srcpos *pos, char const *, ...)
+ __attribute__((format(printf, 2, 3)));
+extern void srcpos_warn(srcpos *pos, char const *, ...)
+ __attribute__((format(printf, 2, 3)));
+
+#endif /* _SRCPOS_H_ */