[PATCH] D33852: Enable __declspec(selectany) on linux

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 1 10:53:31 PDT 2017


aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.

Assuming no sphinx issues with the docs, this LGTM, thank you!



================
Comment at: include/clang/Basic/AttrDocs.td:3154
+
+def SelectAnyDocs : Documentation {
+   let Content = [{This attribute makes global symbol have a weak definition
----------------
Prazek wrote:
> aaron.ballman wrote:
> > I think you need to set the `Category` as well.
> > 
> > To test this you should run something like (replacing <root> and fixing up path separators as needed):
> > ```
> > clang-tblgen -gen-attr-docs -I <root>\llvm\tools\clang\include <root>\llvm\tools\clang\include\clang\Basic\Attr.td -o <root>\llvm\tools\clang\docs\AttributeReference.rst
> > ```
> Thanks for the testing command. Should I do anything in order to check if docs build?
> I enabled docs with -DLLVM_BUILD_DOCS=ON, and I have sphinx. Everything builds, but I don't see docs anywhere.
> 
> the docs looks like this:
> +selectany (gnu::selectany)
> +--------------------------
> +.. csv-table:: Supported Syntaxes
> +   :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma", "Pragma clang attribute"
> +
> +   "X","X","X","", "", ""
> +
> +This attribute appertains to a global symbol, causing it to have a weak
> +definition (
> +.. _`linkonce`: https://llvm.org/docs/LangRef.html#linkage-types
> +), allowing the linker to select any definition.
> +
> +For more information see
> +.. `gcc documentation`: https://gcc.gnu.org/onlinedocs/gcc-7.2.0/gcc/Microsoft-Windows-Variable-Attributes.html
> +
> Thanks for the testing command. Should I do anything in order to check if docs build?

On Windows, I use `make html` within the clang\docs directory to generate the actual sphinx docs -- that will tell you if there are sphinx issues. Be sure you do *not* commit the AttributeReference.rst file that it generates, however.


================
Comment at: test/SemaCXX/attr-selectany.cpp:3
+// RUN: %clang_cc1 -triple x86_64-unknown-linux -fms-compatibility -fms-extensions -fsyntax-only -verify -std=c++11 %s
+// RUN: %clang_cc1 -triple x86_64-win32-macho -fms-compatibility -fms-extensions -fsyntax-only -verify -std=c++11 %s
+
----------------
That has to be the strangest target triple I've ever seen. :-D


https://reviews.llvm.org/D33852





More information about the cfe-commits mailing list