summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTing-Wei Lan <lantw44@gmail.com>2015-11-30 02:45:06 +0800
committerTing-Wei Lan <lantw44@gmail.com>2015-11-30 02:45:06 +0800
commit71ddd0d3f555b82165f98fae4ab814780c915740 (patch)
treefc60d799cc39f581c91ff98fa592a3eb00fe443b
parent91f04bf7a454171f1c37d2a42deada3af82fba55 (diff)
downloadcompiler2015-71ddd0d3f555b82165f98fae4ab814780c915740.tar
compiler2015-71ddd0d3f555b82165f98fae4ab814780c915740.tar.gz
compiler2015-71ddd0d3f555b82165f98fae4ab814780c915740.tar.bz2
compiler2015-71ddd0d3f555b82165f98fae4ab814780c915740.tar.lz
compiler2015-71ddd0d3f555b82165f98fae4ab814780c915740.tar.xz
compiler2015-71ddd0d3f555b82165f98fae4ab814780c915740.tar.zst
compiler2015-71ddd0d3f555b82165f98fae4ab814780c915740.zip
Include our headers before including system headers
-rw-r--r--Makefile.am2
-rw-r--r--src/ast.c4
-rw-r--r--src/draw.c1
-rw-r--r--src/lexer.l7
-rw-r--r--src/main.c5
-rw-r--r--src/parser.y3
-rw-r--r--src/symbol-table.c3
7 files changed, 16 insertions, 9 deletions
diff --git a/Makefile.am b/Makefile.am
index adb07ca..84eb618 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -7,7 +7,7 @@ EXTRA_DIST = autogen.sh Makefile.simple
bin_PROGRAMS = parser
noinst_LIBRARIES = libparser.a
-AM_CPPFLAGS = -I$(top_srcdir)/src
+AM_CPPFLAGS = -I$(top_srcdir)/src -I$(top_builddir)/src
parser_CFLAGS = $(WARN_CFLAGS)
parser_SOURCES = \
diff --git a/src/ast.c b/src/ast.c
index 7d70a68..4d46106 100644
--- a/src/ast.c
+++ b/src/ast.c
@@ -2,10 +2,12 @@
# include "config.h"
#endif
+#include "ast.h"
+
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
-#include "ast.h"
+
extern int line_number;
diff --git a/src/draw.c b/src/draw.c
index 0ecc592..11cad74 100644
--- a/src/draw.c
+++ b/src/draw.c
@@ -4,6 +4,7 @@
#endif
#include "ast.h"
+
#include <assert.h>
#include <stdbool.h>
#include <stdlib.h>
diff --git a/src/lexer.l b/src/lexer.l
index 9d0b9ee..6ed99dc 100644
--- a/src/lexer.l
+++ b/src/lexer.l
@@ -1,11 +1,12 @@
%option noyywrap
%{
+#include "ast.h"
+#include "libparser_a-parser.h"
+#include "symbol-table.h"
+
#include <assert.h>
#include <stdlib.h>
#include <string.h>
-#include "ast.h"
-#include "symbol-table.h"
-#include "src/libparser_a-parser.h"
#define SIZE_OF_ARR(x) (sizeof(x)/sizeof(x[0]))
diff --git a/src/main.c b/src/main.c
index e7ed754..fde8aef 100644
--- a/src/main.c
+++ b/src/main.c
@@ -2,10 +2,11 @@
# include "config.h"
#endif
+#include "ast.h"
+#include "libparser_a-parser.h"
+
#include <stdio.h>
#include <stdlib.h>
-#include "ast.h"
-#include "src/libparser_a-parser.h"
extern FILE *yyin;
extern AST_NODE *prog;
diff --git a/src/parser.y b/src/parser.y
index c705907..2c126c0 100644
--- a/src/parser.y
+++ b/src/parser.y
@@ -3,10 +3,11 @@
# include "config.h"
#endif
+#include "ast.h"
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include "ast.h"
extern int yylex(void);
static void yyerror(const char *mesg);
diff --git a/src/symbol-table.c b/src/symbol-table.c
index 2e18839..008172f 100644
--- a/src/symbol-table.c
+++ b/src/symbol-table.c
@@ -2,12 +2,13 @@
# include "config.h"
#endif
+#include "symbol-table.h"
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <math.h>
-#include "symbol-table.h"
#define TABLE_SIZE 256