[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: /lib/cpp not found in c-mode

From: Nick Roberts
Subject: Re: /lib/cpp not found in c-mode
Date: Thu, 5 May 2005 22:58:45 +1200

 > > > ??? Isn't it a simple matter of looking at the Makefile and passing
 > > > the relevant switches to the preprocessor?  If the Makefile is too
 > > > complex to figure out the switches, I usually invoke "make foo.o" to
 > > > see what switches it uses, then copy them into the c-macro-expand's
 > > > prompt for arguments.
 > > 
 > > Seems like much too much trouble compared to the functionality offered,
 > Not when you really need it, like when a complicated macro causes some
 > bug or compiler message you cannot figure out.

As I'm sure you know, GCC (3.1 onwards) provides macro information if you
specify the options -gdwarf-2 and -g3. So while debugging you can
expand a macro with

/* -*- compile-command: "cc -g3 -o myprog myprog.c myprint.o -lm"; -*- */

#include <stdlib.h>
#include <math.h>

(gdb) macro expand M_PI
expands to: 3.14159265358979323846
(gdb) info macro M_PI
Defined at /usr/include/math.h:311
  included at /home/nick/myprog.c:4
#define M_PI 3.14159265358979323846

If gdb can expand macros using macro information from the executable
(which requires knowledge of include paths and predefined macros), why
can't cpp (or gcc -E) ?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]