Skip to content

[Linux] Import some LLVM fixes for GCC warnings - #3794

Merged
Gregory Roth (pow2clk) merged 3 commits into
microsoft:masterfrom
MarijnS95:gcc-warnings
May 27, 2021
Merged

[Linux] Import some LLVM fixes for GCC warnings#3794
Gregory Roth (pow2clk) merged 3 commits into
microsoft:masterfrom
MarijnS95:gcc-warnings

Conversation

@MarijnS95

Copy link
Copy Markdown
Contributor

And a small clang warning.

Came across these again while testing #3793, having already imported the fixes prior - better to just submit them instead of rotting away on a local branch. They don't nearly cover them all, but especially the memcpy is extremely verbose and makes reading the logs unbearable (though, so is -Wimplicit-fallthrough= and -Woverloaded-virtual).

   ../lib/DxcSupport/dxcmem.cpp:46:55: warning: ISO C++ requires the name after '::~' to be found in the same scope as the name before '::~' [-Wdtor-name]
       g_ThreadMallocTls->llvm::sys::ThreadLocal<IMalloc>::~ThreadLocal();
                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
                                                         ::ThreadLocal
Summary:
This is a new warning which fires when one stores a reference to the
initializer_list contents in a way which may outlive the
initializer_list which it came from. In llvm this warning is triggered
whenever someone uses the initializer_list ArrayRef constructor.

This is indeed a dangerous thing to do (I myself was bitten by that at
least once), but it is not more dangerous than calling other ArrayRef
constructors with temporary objects -- something which we are used to
and have accepted as a tradeoff for ArrayRef's efficiency.

Currently, this warnings generates so much output that it completely
obscures any actionable warnings, so this patch disables it.

Reviewers: rnk, aaron.ballman

Subscribers: mgorny, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D70122

Picked from: https://github.com/llvm/llvm-project/commit/6c2151bf4c829958891e65a4cc396daa6d308eb0.patch
@AppVeyorBot

Copy link
Copy Markdown

@jaebaek Jaebaek Seo (jaebaek) left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. Thanks!

@pow2clk Gregory Roth (pow2clk) left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! We often add // HLSL Change comments to changes in LLVM files, but since these are drawn from upstream LLVM, it's not really applicable here.

@pow2clk
Gregory Roth (pow2clk) merged commit 0669cbf into microsoft:master May 27, 2021
@MarijnS95
Marijn Suijten (MarijnS95) deleted the gcc-warnings branch May 27, 2021 08:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants