From 11179a2a71572972f0b19d8be5974ad338915b9f Mon Sep 17 00:00:00 2001 From: Dale Weiler Date: Tue, 4 Jun 2013 02:47:07 +0000 Subject: [PATCH] Major header reworking, this respects the namespaces properly. Makes object dependency more obvious, allows for better make caches, and prevents misuse of library features, i.e use con_* instead of printf. --- ast.c | 1 - code.c | 1 + conout.c | 1 - correct.c | 1 + exec.c | 1 + ftepp.c | 3 +++ gmqcc.h | 6 +----- ir.c | 1 + lexer.c | 6 ++---- lexer.h | 1 - main.c | 8 +++++++- opts.c | 5 +++++ pak.c | 3 +++ parser.c | 3 +-- stat.c | 11 ++++++++++- test.c | 5 ++++- util.c | 5 +++-- 17 files changed, 43 insertions(+), 19 deletions(-) diff --git a/ast.c b/ast.c index 81e1c12..d845eb2 100644 --- a/ast.c +++ b/ast.c @@ -21,7 +21,6 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#include #include #include diff --git a/code.c b/code.c index 35f758a..c2838ef 100644 --- a/code.c +++ b/code.c @@ -21,6 +21,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ +#include #include "gmqcc.h" /* diff --git a/conout.c b/conout.c index 687fdf4..80ec5e1 100644 --- a/conout.c +++ b/conout.c @@ -21,7 +21,6 @@ * SOFTWARE. */ #include "gmqcc.h" -#include /* * isatty/STDERR_FILENO/STDOUT_FILNO diff --git a/correct.c b/correct.c index 7e16608..f501817 100644 --- a/correct.c +++ b/correct.c @@ -21,6 +21,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ +#include #include "gmqcc.h" /* diff --git a/exec.c b/exec.c index 49cff44..18b9f30 100644 --- a/exec.c +++ b/exec.c @@ -26,6 +26,7 @@ #include #include #include +#include #include "gmqcc.h" diff --git a/ftepp.c b/ftepp.c index 5348dfb..0a9ff5b 100644 --- a/ftepp.c +++ b/ftepp.c @@ -22,7 +22,10 @@ * SOFTWARE. */ #include +#include +#include #include + #include "gmqcc.h" #include "lexer.h" diff --git a/gmqcc.h b/gmqcc.h index 5922b84..6dde0cd 100644 --- a/gmqcc.h +++ b/gmqcc.h @@ -23,12 +23,8 @@ */ #ifndef GMQCC_HDR #define GMQCC_HDR -#include -#include -#include #include -#include -#include +#include /* TODO: remove this */ /* * Disable some over protective warnings in visual studio because fixing them is a waste diff --git a/ir.c b/ir.c index 5dae734..fcf4caa 100644 --- a/ir.c +++ b/ir.c @@ -23,6 +23,7 @@ */ #include #include + #include "gmqcc.h" #include "ir.h" diff --git a/lexer.c b/lexer.c index 862131e..8289057 100644 --- a/lexer.c +++ b/lexer.c @@ -20,14 +20,12 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#include -#include +#include #include -#include +#include #include "gmqcc.h" #include "lexer.h" - /* * List of Keywords */ diff --git a/lexer.h b/lexer.h index cde0863..f51d56e 100644 --- a/lexer.h +++ b/lexer.h @@ -22,7 +22,6 @@ */ #ifndef GMQCC_LEXER_HDR #define GMQCC_LEXER_HDR - typedef struct token_s token; struct token_s { diff --git a/main.c b/main.c index 5717fb5..cbcadf1 100644 --- a/main.c +++ b/main.c @@ -21,9 +21,15 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ +#include +#include +#include +#include +#include + + #include "gmqcc.h" #include "lexer.h" -#include /* TODO: cleanup this whole file .. it's a fuckign mess */ diff --git a/opts.c b/opts.c index abd012f..4cfa79c 100644 --- a/opts.c +++ b/opts.c @@ -21,7 +21,12 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ +#include +#include +#include + #include "gmqcc.h" + unsigned int opts_optimizationcount[COUNT_OPTIMIZATIONS]; opts_cmd_t opts; /* command lien options */ diff --git a/pak.c b/pak.c index ac31bdf..2371ee1 100644 --- a/pak.c +++ b/pak.c @@ -20,6 +20,9 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ +#include +#include + #include "gmqcc.h" /* diff --git a/parser.c b/parser.c index cf69136..e92cb6e 100644 --- a/parser.c +++ b/parser.c @@ -21,8 +21,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#include -#include +#include #include #include "gmqcc.h" diff --git a/stat.c b/stat.c index 0192a2f..aecd7eb 100644 --- a/stat.c +++ b/stat.c @@ -1,3 +1,7 @@ +#include +#include +#include + #include "gmqcc.h" /* @@ -22,6 +26,12 @@ typedef struct { size_t value; } stat_size_entry_t, **stat_size_table_t; +typedef struct { + uint64_t used; + uint64_t type; + uint64_t size; +} stat_entry_t; + static uint64_t stat_mem_allocated = 0; static uint64_t stat_mem_deallocated = 0; static uint64_t stat_mem_allocated_total = 0; @@ -37,7 +47,6 @@ static stat_size_table_t stat_size_vectors = NULL; static stat_size_table_t stat_size_hashtables = NULL; static stat_mem_block_t *stat_mem_block_root = NULL; - /* * A tiny size_t key-value hashtbale for tracking vector and hashtable * sizes. We can use it for other things too, if we need to. This is diff --git a/test.c b/test.c index e6567f0..1ebb33a 100644 --- a/test.c +++ b/test.c @@ -20,10 +20,13 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#include "gmqcc.h" +#include +#include #include #include +#include "gmqcc.h" + opts_cmd_t opts; static const char *task_bins[] = { diff --git a/util.c b/util.c index c6c8925..5e234ae 100644 --- a/util.c +++ b/util.c @@ -21,8 +21,9 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#include -#include +#include +#include + #include "gmqcc.h" void util_debug(const char *area, const char *ms, ...) { -- 2.39.2