[Bug c/12285] New: Add sizeof_function functionality

mkgnu at gmx dot net gcc-bugzilla@gcc.gnu.org
Mon Sep 15 08:52:00 GMT 2003


PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12285

           Summary: Add sizeof_function functionality
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: mkgnu at gmx dot net
                CC: gcc-bugs at gcc dot gnu dot org

I am requesting the feature of adding a means of computing the size of a
function at run time. 

This is currently accomplished using something similar to...

#define END_OF_FUNCTION(name) void name##_end(void) { }
#define END_OF_STATIC_FUNCTION(name) static void name##_end(void) { }

void func1(void) { ... } END_OF_FUNCTION(func1);
void func2(void) { ... } END_OF_FUNCTION(func2);

...and then manually computing &function_end - &function_name + 1

However this approach cannot be used for computing the size of ANY function
unless all functions are defined that way, which makes it "difficult" to deal
with large scale projects (e.g. linux kernel).

Discussions regarding this feature can be found at:

http://gcc.gnu.org/ml/gcc-help/2003-07/msg00067.html

Please contact me for more information.



More information about the Gcc-bugs mailing list