> Another oddity:  The -Wmissing-declarations flag on the compiler did
> not find all of my missing prototypes!  In my case I had three
> functions that basically are providing malloc, free, and realloc
> style memory management (I'm porting an existing code base to Palm).
> Those three functions are wrapped with macros, but didn't have
> prototypes in my header files (an oversight).  -Wmissing-declarations
> did not find this problem.  I'm thinking that lint or some other tool
> may be necessary to insure that every single function has a prototype
> everywhere it is referenced.

I need to post a correction for this.  I just found prototypes (that were
missing the segment declarations) in another header file that I had missed
before.  So from the point of view of -Wmissing-declarations, the functions
were properly prototyped.

I've developed a technique for finding functions that are missing segment
declarations on their prototypes:

1. Make sure all function prototypes that you know of have a segmenting
declaration on them.

int foo(int bar) SEGMENT1;

2. Make sure none of your functions are declaring their segmenting via the
"shorthand" method.

int SEGMENT1 foo(int bar) {
  ...
}

If you find things like the above, rename the segmenting macro to something
else for the purposes of the check and define it to be nothing:

#define SEGMENT1_CHECK

int SEGMENT1_CHECK foo(int bar) {
  ...
}

By renaming the segment macro on the function definition to something
similar, you'll be able to set it back later.

3. Build the project and ask for a memory map on the link step.

m68k-palmos-gcc -Xlinker -M $(LDFLAGS) $(OBJS) sections.ld > myapp.map 2>&1

4. Inspect myapp.map to see where the various functions get placed.  If a
function is in an unexpected place, you're missing a segment declaration via
prototype somewhere!

Rick Reynolds


-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/support/forums/

Reply via email to