Bug 335442 - create a function definition "skeleton" from a function call site
Summary: create a function definition "skeleton" from a function call site
Status: NEW
Alias: None
Product: CDT
Classification: Tools
Component: cdt-editor (show other bugs)
Version: 8.0   Edit
Hardware: PC Linux
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact: Jonah Graham CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-01-26 08:34 EST by m c CLA
Modified: 2020-09-04 15:18 EDT (History)
6 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description m c CLA 2011-01-26 08:34:12 EST
Build Identifier: 20100917-0705

I'm using cdt 7 on helios on ubuntu 10.10. Also using the Linux toolchain (gcc, etc). Suppose I have some C code like the following
(which I just made up for this example):

  int i = 5;
  float f = 5.0;
  char* message = "how arbitrary";

  some_local_function(i, f, message);

Is there some tool/function/magic that would generate the prototype for
function 'some_local_function' from it's call site? In this case,
I would get:

void
some_local_function(int i, float f, char* message) {
  // Add your code here
}

... placed *above* the function that made the call. I couldn't find anything like this. I'm just doing it by hand. I can do this in Java with other IDEs (I think intellij idea 10 does it).

Thanks. 

Reproducible: Always
Comment 1 Axel Mueller CLA 2011-01-26 11:28:26 EST
(In reply to comment #0)
> ... placed *above* the function that made the call.
I think we have to distinguish between two use cases.
1) create a local function prototype (as suggested)
2) create a function prototype in another source file
=> - dialog to choose which source file
   - put prototype in the source file
   - put declaration in the corresponding header file
   - put an include statement in the original file
Comment 2 Tomasz Wesolowski CLA 2011-06-16 11:50:50 EDT
I think this sounds like one of quick fix proposals on the problem marker which would be currently generated by Codan in the place of unknown function call (at least in C++; in C calling an undefined function is legal AFAICR).