EricWF updated this revision to Diff 30082. EricWF marked 3 inline comments as done. EricWF added a comment.
Make changes requested by @danalbert. http://reviews.llvm.org/D8652 Files: include/__config include/locale test/libcxx/symbols/inline_namespace.sh.cpp test/libcxx/test/config.py utils/sym_check/sym_match.py
Index: utils/sym_check/sym_match.py =================================================================== --- utils/sym_check/sym_match.py +++ utils/sym_check/sym_match.py @@ -36,6 +36,9 @@ sys.stdout.write(report) if matching_count != 0: print('%d matching symbols found...' % matching_count) + sys.exit(0) + else: + sys.exit(1) if __name__ == '__main__': Index: test/libcxx/test/config.py =================================================================== --- test/libcxx/test/config.py +++ test/libcxx/test/config.py @@ -631,6 +631,21 @@ sub = self.config.substitutions # Configure compiler substitions sub.append(('%cxx', self.cxx.path)) + # Add %libcxx as a substition for the full path to the created libc++ + # library. + libcxx_root = self.cxx_library_root + assert libcxx_root + libcxx_lib = os.path.join(libcxx_root, 'libc++.a') + if os.path.isfile(libcxx_lib): + pass # Use libc++.a as libcxx_lib. + elif self.target_info.platform() == 'darwin': + libcxx_lib = os.path.join(libcxx_root, 'libc++.dylib') + else: + libcxx_lib = os.path.join(libcxx_root, 'libc++.so') + if not os.path.isfile(libcxx_lib): + self.lit_config.error("Failed to find libc++ library in %s" % + libcxx_root) + sub.append(('%libcxx', str(libcxx_lib))) # Configure flags substitutions flags_str = ' '.join(self.cxx.flags) compile_flags_str = ' '.join(self.cxx.compile_flags) @@ -650,10 +665,22 @@ sub.append(('%compile', compile_str)) sub.append(('%link', link_str)) sub.append(('%build', build_str)) + # Build the PATH variable from sys.path and self.lit_config.path + # and self.env['PATH']. Also add libcxx/utils/sym_check to the path. + path_list = [] + if 'PATH' in os.environ: + path_list += os.environ['PATH'].split(':') + path_list += self.lit_config.path + if 'PATH' in self.env: + path_list += self.env['PATH'].split(':') + path_list += [os.path.join(self.libcxx_src_root, 'utils', 'sym_check')] + env_cpy = dict(self.env) + env_cpy['PATH'] = ':'.join(path_list) # Configure exec prefix substitutions. - exec_env_str = 'env ' if len(self.env) != 0 else '' - for k, v in self.env.items(): + exec_env_str = 'env ' if len(env_cpy) != 0 else '' + for k, v in env_cpy.items(): exec_env_str += ' %s=%s' % (k, v) + sub.append(('%env', exec_env_str)) # Configure run env substitution. exec_str = '' if self.lit_config.useValgrind: Index: test/libcxx/symbols/inline_namespace.sh.cpp =================================================================== --- /dev/null +++ test/libcxx/symbols/inline_namespace.sh.cpp @@ -0,0 +1,16 @@ +// Test that symbols withing the __libcpp_internal namespace are given hidden +// visibility and do not appear in the dylib. + +// Check that these example symbols do not appear. +// RUN: %env not sym_match.py %libcxx \ +// RUN: [_]+ZNSt3110sscanf_lEPKcP15__locale_structS1_z \ +// RUN: [_]+ZNSt3__117__libcpp_internal10__sscanf_lEPKcP15__locale_structS2_z \ +// RUN: [_]+ZNSt3112asprintf_lEPPcP15__locale_structPKcz \ +// RUN: [_]+ZNSt3__117__libcpp_internal12__asprintf_lEPPcP15__locale_structPKcz \ +// RUN: [_]+ZNSt3112snprintf_lEPcmP15__locale_structPKcz \ +// RUN: [_]+ZNSt3__117__libcpp_internal12__snprintf_lEPcmP15__locale_structPKcz + +// Check that no symbols in the __libcpp_internal namespace have been emitted +// into the dylib. +// RUN: %env not sym_match.py %libcxx .*__libcpp_internal + Index: include/locale =================================================================== --- include/locale +++ include/locale @@ -368,6 +368,8 @@ #endif } +_LIBCPP_BEGIN_NAMESPACE_INTERNAL + inline int __snprintf_l(char *__s, size_t __n, locale_t __l, const char *__format, ...) { va_list __va; @@ -410,6 +412,8 @@ return __res; } +_LIBCPP_END_NAMESPACE_INTERNAL + #endif // __linux__ // __scan_keyword Index: include/__config =================================================================== --- include/__config +++ include/__config @@ -567,6 +567,15 @@ #endif // __clang__ || __GNUC__ || _MSC_VER || __IBMCPP__ +#define _LIBCPP_BEGIN_NAMESPACE_INTERNAL namespace __libcpp_internal _LIBCPP_HIDDEN { +#define _LIBCPP_END_NAMESPACE_INTERNAL } + +_LIBCPP_BEGIN_NAMESPACE_STD + _LIBCPP_BEGIN_NAMESPACE_INTERNAL + _LIBCPP_END_NAMESPACE_INTERNAL + using namespace __libcpp_internal; +_LIBCPP_END_NAMESPACE_STD + #ifdef _LIBCPP_HAS_NO_UNICODE_CHARS typedef unsigned short char16_t; typedef unsigned int char32_t;
_______________________________________________ cfe-commits mailing list cfe-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits