new calling convention pragma

I'm experimenting with adding two new pragmas of the form #pragma push_cc(calling_convention) and #pragma pop_cc. Basically, I want to keep a stack of default calling conventions. You can change the default from cdecl by doing a push_cc and specifying a different calling convention like __stdcall. Then, you can pop the stack with #pragma pop_cc. A function which does not specify a calling convention would then get the calling at the top of the stack.

Any ideas on the best way to approach this modification?



Start from the handling of #pragma GCC visibility. I think that's very
similiar to your problem.