From 992ceee52b81a312ad22a1b907213195837dd0c2 Mon Sep 17 00:00:00 2001 From: "Markus F.X.J. Oberhumer" Date: Mon, 13 Jan 2003 17:50:04 +0000 Subject: [PATCH] CLeanups. committer: mfx 1042480204 +0000 --- src/Makedefs.dep | 12 ++++++++++-- src/Makedefs.gcc | 2 ++ src/Makefile | 4 ++-- src/conf.h | 2 +- src/filteri.cpp | 2 +- src/main.cpp | 2 +- src/p_w32pe.cpp | 4 ++-- 7 files changed, 19 insertions(+), 9 deletions(-) diff --git a/src/Makedefs.dep b/src/Makedefs.dep index 7d12a5f1..97dd2ed1 100644 --- a/src/Makedefs.dep +++ b/src/Makedefs.dep @@ -1,9 +1,14 @@ +ifeq ($(USE_GCC_DEPS),1) +ifeq ($(DEPS_DONE),) +DEPS_DONE = 1 + # /*********************************************************************** -# // automated dependencies +# // gcc automated dependencies # ************************************************************************/ -CFLAGS += -Wp,-MMD,.deps/$(*F).pp +EXTRA_CFLAGS += -Wp,-MMD,.deps/$(*F).pp +EXTRA_CXXFLAGS += -Wp,-MMD,.deps/$(*F).pp ifeq ($(strip $(wildcard .deps)),) DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :) @@ -14,3 +19,6 @@ else endif endif + +endif +endif diff --git a/src/Makedefs.gcc b/src/Makedefs.gcc index e41a541a..edbfa8b5 100644 --- a/src/Makedefs.gcc +++ b/src/Makedefs.gcc @@ -1,3 +1,5 @@ +USE_GCC_DEPS := 1 + # /*********************************************************************** # // defaults for gcc diff --git a/src/Makefile b/src/Makefile index 47d29c0e..aad740d3 100644 --- a/src/Makefile +++ b/src/Makefile @@ -212,7 +212,7 @@ endif # linux ifeq ($(target),cross-m68k-linux) include $(srcdir)/Makedefs.gcc CC = m68k-linux-gcc -CC = m68k-linux-g++ +CXX = m68k-linux-g++ DEFS += '-DUPX_CONFIG_H="config_h/linux.h"' ##LDLIBS += -lmcheck endif # cross-m68k-linux @@ -568,6 +568,6 @@ endif # // dependencies # ************************************************************************/ -include $(srcdir)/Makedefs.dep +-include $(srcdir)/Makedefs.dep # vi:nowrap diff --git a/src/conf.h b/src/conf.h index f840eb47..24416ee3 100644 --- a/src/conf.h +++ b/src/conf.h @@ -411,7 +411,7 @@ typedef RETSIGTYPE (SIGTYPEENTRY *sig_type)(int); # define UNUSED(parm) (parm = parm) #endif -#define HIGH(array) ((unsigned) (sizeof(array)/sizeof((array)[0]))) +#define TABLESIZE(table) ((sizeof(table)/sizeof((table)[0]))) #define ALIGN_DOWN(a,b) (((a) / (b)) * (b)) #define ALIGN_UP(a,b) ALIGN_DOWN((a) + ((b) - 1), b) diff --git a/src/filteri.cpp b/src/filteri.cpp index f98f88eb..2829a18f 100644 --- a/src/filteri.cpp +++ b/src/filteri.cpp @@ -232,7 +232,7 @@ const FilterImp::FilterEntry FilterImp::filters[] = { { 0xb3,99, 0, f_sub32_4, u_sub32_4, s_sub32_4 }, }; -const int FilterImp::n_filters = HIGH(filters); +const int FilterImp::n_filters = TABLESIZE(filters); /* diff --git a/src/main.cpp b/src/main.cpp index d500f2aa..0de14a85 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -66,7 +66,7 @@ void init_options(struct options_t *o) o->w32pe.compress_exports = 1; o->w32pe.compress_icons = 2; o->w32pe.compress_resources = -1; - for (unsigned i = 0; i < HIGH(opt->w32pe.compress_rt); i++) + for (unsigned i = 0; i < TABLESIZE(opt->w32pe.compress_rt); i++) opt->w32pe.compress_rt[i] = -1; opt->w32pe.compress_rt[24] = false; // 24 == RT_MANIFEST o->w32pe.strip_relocs = -1; diff --git a/src/p_w32pe.cpp b/src/p_w32pe.cpp index 8fc9415c..e8054dac 100644 --- a/src/p_w32pe.cpp +++ b/src/p_w32pe.cpp @@ -88,7 +88,7 @@ PackW32Pe::PackW32Pe(InputFile *f) : super(f) //printf("pe_section_t %d\n", (int) sizeof(pe_section_t)); COMPILE_TIME_ASSERT(sizeof(pe_header_t) == 248); COMPILE_TIME_ASSERT(sizeof(pe_section_t) == 40); - COMPILE_TIME_ASSERT(RT_LAST == HIGH(opt->w32pe.compress_rt)); + COMPILE_TIME_ASSERT(RT_LAST == TABLESIZE(opt->w32pe.compress_rt)); isection = NULL; oimport = NULL; @@ -1831,7 +1831,7 @@ void PackW32Pe::pack(OutputFile *fo) memset(osection,0,sizeof(osection)); oh.entry = upxsection; - oh.objects = HIGH(osection); + oh.objects = 3; oh.chksum = 0; // fill the data directory