GRUB_FILE implementation

This commit is contained in:
Vladimir 'phcoder' Serbinenko 2010-02-09 15:32:42 +01:00
parent 660960d697
commit 2d2a9cd5b6
9 changed files with 29 additions and 16 deletions

13
ChangeLog.grub-file Normal file
View File

@ -0,0 +1,13 @@
2010-02-09 Vladimir Serbinenko <phcoder@gmail.com>
Don't use __FILE__.
* genmk.rb: Add -DGRUB_FILE to all C targets.
* fs/reiserfs.c: Replace __FILE__ with GRUB_FILE.
* include/grub/list.h: Likewise.
* include/grub/misc.h: Likewise.
* include/grub/mm.h: Likewise.
* include/grub/test.h: Likewise.
* kern/mm.c: Likewise.
* lib/libgcrypt_wrap/cipher_wrap.h: Likewise.

View File

@ -62,7 +62,7 @@
static grub_dl_t my_mod;
#define assert(boolean) real_assert (boolean, __FILE__, __LINE__)
#define assert(boolean) real_assert (boolean, GRUB_FILE, __LINE__)
static inline void
real_assert (int boolean, const char *file, const int line)
{

View File

@ -91,7 +91,7 @@ endif
dir = File.dirname(src)
"#{obj}: #{src} $(#{src}_DEPENDENCIES)
$(TARGET_CC) -I#{dir} -I$(srcdir)/#{dir} $(TARGET_CPPFLAGS) #{extra_flags} $(TARGET_#{flag}) $(#{prefix}_#{flag}) -MD -c -o $@ $<
$(TARGET_CC) -I#{dir} -I$(srcdir)/#{dir} $(TARGET_CPPFLAGS) #{extra_flags} $(TARGET_#{flag}) $(#{prefix}_#{flag}) -DGRUB_FILE=\\\"#{src}\\\" -MD -c -o $@ $<
-include #{dep}
"
@ -163,7 +163,7 @@ endif
$(TARGET_CC) $(#{prefix}_LDFLAGS) $(TARGET_LDFLAGS) -Wl,-r,-d -o $@ #{objs_str}
#{mod_obj}: #{mod_src}
$(TARGET_CC) $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(#{prefix}_CFLAGS) -c -o $@ $<
$(TARGET_CC) $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(#{prefix}_CFLAGS) -DGRUB_FILE=\\\"#{mod_src}\\\" -c -o $@ $<
#{mod_src}: $(builddir)/moddep.lst $(srcdir)/genmodsrc.sh
sh $(srcdir)/genmodsrc.sh '#{mod_name}' $< > $@ || (rm -f $@; exit 1)
@ -197,7 +197,7 @@ endif
dir = File.dirname(src)
"#{obj}: #{src} $(#{src}_DEPENDENCIES)
$(TARGET_CC) -I#{dir} -I$(srcdir)/#{dir} $(TARGET_CPPFLAGS) #{extra_flags} $(TARGET_#{flag}) $(#{prefix}_#{flag}) -MD -c -o $@ $<
$(TARGET_CC) -I#{dir} -I$(srcdir)/#{dir} $(TARGET_CPPFLAGS) #{extra_flags} $(TARGET_#{flag}) $(#{prefix}_#{flag}) -DGRUB_FILE=\\\"#{src}\\\" -MD -c -o $@ $<
-include #{dep}
clean-module-#{extra_target}.#{@rule_count}:
@ -299,7 +299,7 @@ MOSTLYCLEAN_UTILITY_TARGETS += mostlyclean-utility-#{@name}.#{@rule_count}
dir = File.dirname(src)
"#{obj}: #{src} $(#{src}_DEPENDENCIES)
$(CC) -I#{dir} -I$(srcdir)/#{dir} $(CPPFLAGS) $(CFLAGS) -DGRUB_UTIL=1 $(#{prefix}_CFLAGS) -MD -c -o $@ $<
$(CC) -I#{dir} -I$(srcdir)/#{dir} $(CPPFLAGS) $(CFLAGS) -DGRUB_UTIL=1 $(#{prefix}_CFLAGS) -DGRUB_FILE=\\\"#{src}\\\" -MD -c -o $@ $<
-include #{dep}
"
@ -346,7 +346,7 @@ endif
dir = File.dirname(src)
"#{obj}: #{src} $(#{src}_DEPENDENCIES)
$(TARGET_CC) -I#{dir} -I$(srcdir)/#{dir} $(TARGET_CPPFLAGS) #{extra_flags} $(TARGET_#{flag}) $(#{prefix}_#{flag}) -MD -c -o $@ $<
$(TARGET_CC) -I#{dir} -I$(srcdir)/#{dir} $(TARGET_CPPFLAGS) #{extra_flags} $(TARGET_#{flag}) $(#{prefix}_#{flag}) -DGRUB_FILE=\\\"#{src}\\\" -MD -c -o $@ $<
-include #{dep}

View File

@ -52,7 +52,7 @@ grub_bad_type_cast_real (int line, const char *file)
return 0;
}
#define grub_bad_type_cast() grub_bad_type_cast_real(__LINE__, __FILE__)
#define grub_bad_type_cast() grub_bad_type_cast_real(__LINE__, GRUB_FILE)
#define GRUB_FIELD_MATCH(ptr, type, field) \
((char *) &(ptr)->field == (char *) &((type) (ptr))->field)

View File

@ -46,7 +46,7 @@
#define ARRAY_SIZE(array) (sizeof (array) / sizeof (array[0]))
#define COMPILE_TIME_ASSERT(cond) switch (0) { case 1: case !(cond): ; }
#define grub_dprintf(condition, fmt, args...) grub_real_dprintf(__FILE__, __LINE__, condition, fmt, ## args)
#define grub_dprintf(condition, fmt, args...) grub_real_dprintf(GRUB_FILE, __LINE__, condition, fmt, ## args)
/* XXX: If grub_memmove is too slow, we must implement grub_memcpy. */
#define grub_memcpy(d,s,n) grub_memmove ((d), (s), (n))

View File

@ -44,19 +44,19 @@ void grub_mm_dump_free (void);
void grub_mm_dump (unsigned lineno);
#define grub_malloc(size) \
grub_debug_malloc (__FILE__, __LINE__, size)
grub_debug_malloc (GRUB_FILE, __LINE__, size)
#define grub_zalloc(size) \
grub_debug_zalloc (__FILE__, __LINE__, size)
grub_debug_zalloc (GRUB_FILE, __LINE__, size)
#define grub_realloc(ptr,size) \
grub_debug_realloc (__FILE__, __LINE__, ptr, size)
grub_debug_realloc (GRUB_FILE, __LINE__, ptr, size)
#define grub_memalign(align,size) \
grub_debug_memalign (__FILE__, __LINE__, align, size)
grub_debug_memalign (GRUB_FILE, __LINE__, align, size)
#define grub_free(ptr) \
grub_debug_free (__FILE__, __LINE__, ptr)
grub_debug_free (GRUB_FILE, __LINE__, ptr)
void *EXPORT_FUNC(grub_debug_malloc) (const char *file, int line,
grub_size_t size);

View File

@ -54,7 +54,7 @@ void grub_test_nonzero (int cond, const char *file,
/* Macro to fill in location details and an optional error message. */
#define grub_test_assert(cond, ...) \
grub_test_nonzero(cond, __FILE__, __FUNCTION__, __LINE__, \
grub_test_nonzero(cond, GRUB_FILE, __FUNCTION__, __LINE__, \
## __VA_ARGS__, \
"assert failed: %s", #cond)

View File

@ -388,7 +388,7 @@ grub_free (void *ptr)
do
{
grub_printf ("%s:%d: q=%p, q->size=0x%x, q->magic=0x%x\n",
__FILE__, __LINE__, q, q->size, q->magic);
GRUB_FILE, __LINE__, q, q->size, q->magic);
q = q->next;
}
while (q != r->first);

View File

@ -59,7 +59,7 @@ typedef union {
double g;
} PROPERLY_ALIGNED_TYPE;
#define gcry_assert(x) grub_assert_real(__FILE__, __LINE__, x)
#define gcry_assert(x) grub_assert_real(GRUB_FILE, __LINE__, x)
static inline void
grub_assert_real (const char *file, int line, int cond)