Pure-inline function checking iterates all decls
Correct handling of later-non-purified inline functions
tools/debug_scope doesn't print unscoped lines
Correctly handle static-redefinition
Correctly emit decls with the right linkage
Correct handling of static/non-static variable redefinition
Distinguish between different variables in different scopes
Prototype decls link to their implementation (for forward-inlining)

Cherry-picked from f94f6161243f009326c2a1cf525d0ee5c09b114f.
Needed for inline function definition checks, e.g.

inline int f(){ ... }
extern int f(); // causes f to be emitted
Correctly handle 'extern f()' after 'f' is declared inline
Redefinition type checks use type_cmp(), not decl_cmp()
Merge branch 'fix/static-propagation'