New loplugin:stdfunction

Desktop / LibreOffice - Stephan Bergmann [redhat.com] - 28 August 2019 10:47 EDT

...finding dubious additions to namespace std (concentrating on functions for now). C++17 [namespace.std]/1: "The behavior of a C ++ program is undefined if it adds declarations or definitions to namespace std or to a namespace within namespace std unless otherwise specified."

This found

ad4c7b97752b4da73808402604d6f96b39d920f5 "Avoid declaring function templates in namespace std" 042e30a3dc057aef4a02d95960e4dd4fb8d083ae "Avoid adding a function template declaration to namespace std" cae9240a76cdb0eeed92421930d3b4cbef0ac201 "Avoid adding a function declaration to namespace std"

Change-Id: Ic2ba54e2a8bf931d5c58cedf499c0d1229eb2166 Reviewed-on: https://gerrit.libreoffice.org/78220

5f3c2204eb7d New loplugin:stdfunction
compilerplugins/clang/check.cxx | 37 +++++++++++++++---
compilerplugins/clang/check.hxx | 13 +++----
compilerplugins/clang/stdfunction.cxx | 48 ++++++++++++++++++++++++
compilerplugins/clang/test/stdfunction.cxx | 56 ++++++++++++++++++++++++++++
solenv/CompilerTest_compilerplugins_clang.mk | 1 +
5 files changed, 142 insertions(+), 13 deletions(-)

Upstream: cgit.freedesktop.org


  • Share