[PATCH] D13925: Implement __attribute__((internal_linkage))

Reid Kleckner via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 4 11:40:34 PST 2015


rnk added a comment.

This is an interesting test case, though:

  inline int foo() {
    static int __attribute__((internal_linkage)) x;
    return x++;
  }

If foo gets inlined, those call sites will use and update 'x'. If foo is not inlined, one definition of foo will win, and every caller will use its version of 'x'.

We could emit a warning, but I kind of don't care. If you're using internal_linkage, you are operating outside the rules of C++. You're expecting multiple copies of these things to be emitted.


Repository:
  rL LLVM

http://reviews.llvm.org/D13925





More information about the cfe-commits mailing list