Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • openfoam openfoam
  • Project information
    • Project information
    • Activity
    • Labels
    • Planning hierarchy
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 385
    • Issues 385
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 13
    • Merge requests 13
  • Deployments
    • Deployments
    • Releases
  • Wiki
    • Wiki
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • Development
  • openfoamopenfoam
  • Issues
  • #1657

Closed
Open
Created Mar 31, 2020 by Alexey Matveichev@alexey

deprecated attribute location

Summary

Location of FOAM_DEPRECATED and FOAM_DEPRECATED_FOR macros invocations is incorrect. It is placed between type and method name, while according to [1] it should be before type.

  1. https://en.cppreference.com/w/cpp/language/attributes/deprecated

Steps to reproduce

Build OpenFOAM v1912 with std=c++14. Yes, currently code should be built with std=c++11 but eventually it will be upgraded to newer standard.

Example case

This change resolve the issue (example from dictionary.H):

-        ITstream& FOAM_DEPRECATED_FOR(2018-07, "lookup() method")
-        operator[](const word& keyword) const
+        FOAM_DEPRECATED_FOR(2018-07, "lookup() method")
+        ITstream& operator[](const word& keyword) const

What is the current bug behaviour?

If code is compiled with std=c++14 current location of macros invocation produces the error:

~/OpenFOAM/OpenFOAM-v1912/src/OpenFOAM/lnInclude/SLListBase.H:223:18: error: 'deprecated' attribute cannot be applied to
      types
            bool FOAM_DEPRECATED_FOR(2019-01, "good() method") found() const
                 ^
~/OpenFOAM/OpenFOAM-v1912/src/OpenFOAM/lnInclude/stdFoam.H:59:52: note: expanded from macro 'FOAM_DEPRECATED_FOR'
# define FOAM_DEPRECATED_FOR(since, replacement) [[deprecated("Since " #since "; use " #replacement)]]

What is the expected correct behavior?

Compilation with correct location of the attribute does not produce error.

Environment information

  • OpenFOAM version : v1912
  • Operating system : macOS (10.15.4)
  • Hardware info : N/A
  • Compiler : Apple clang version 11.0.3 (clang-1103.0.32.29)

Possible fixes

Move macros invocation to correct location. See: deprecated-attribute.patch.

Assignee
Assign to
Time tracking