Commit 492cca24 by Jason Merrill

decl.c (maybe_commonize_var): Set DECL_UNINLINABLE for statics in inlines.

        * decl.c (maybe_commonize_var): Set DECL_UNINLINABLE for statics
        in inlines.

From-SVN: r37394
parent 8ee322c9
2000-11-09 Jason Merrill <jason@redhat.com>
* decl.c (maybe_commonize_var): Set DECL_UNINLINABLE for statics
in inlines.
2000-11-10 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> 2000-11-10 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* decl.c (grokdeclarator, save_function_data): Use memcpy, not bcopy. * decl.c (grokdeclarator, save_function_data): Use memcpy, not bcopy.
...@@ -28,10 +33,10 @@ ...@@ -28,10 +33,10 @@
2000-11-07 Eric Christopher <echristo@redhat.com> 2000-11-07 Eric Christopher <echristo@redhat.com>
* decl.c (init_decl_processing): Change definition of * decl.c (init_decl_processing): Change definition of
__wchar_t to wchar_t. Remove artificial declaration of __wchar_t to wchar_t. Remove artificial declaration of
wchar_t. wchar_t.
* lex.c: Change instances of __wchar_t to wchar_t. * lex.c: Change instances of __wchar_t to wchar_t.
2000-11-09 Nathan Sidwell <nathan@codesourcery.com> 2000-11-09 Nathan Sidwell <nathan@codesourcery.com>
......
...@@ -7655,6 +7655,7 @@ maybe_commonize_var (decl) ...@@ -7655,6 +7655,7 @@ maybe_commonize_var (decl)
inlining of such functions. */ inlining of such functions. */
current_function_cannot_inline current_function_cannot_inline
= "function with static variable cannot be inline"; = "function with static variable cannot be inline";
DECL_UNINLINABLE (current_function_decl) = 1;
/* If flag_weak, we don't need to mess with this, as we can just /* If flag_weak, we don't need to mess with this, as we can just
make the function weak, and let it refer to its unique local make the function weak, and let it refer to its unique local
......
inline int f ()
{
static int k;
return ++k;
}
int g ()
{
return f();
}
// Test that statics in inline functions are unified between
// translation units. Currently we handle this by just suppressing
// inling and relying on unification of the function itself.
// Special g++ Options: -O
// Additional sources: comdat1-aux.cc
inline int f ()
{
static int i;
return ++i;
}
int g ();
int main ()
{
if (f() != 1
|| g() != 2
|| f() != 3)
return 1;
return 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment