File: UseNativeC%2B%2BSyntax.sh

package info (click to toggle)
insighttoolkit5 5.4.4-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 704,404 kB
  • sloc: cpp: 783,697; ansic: 628,724; xml: 44,704; fortran: 34,250; python: 22,874; sh: 4,078; pascal: 2,636; lisp: 2,158; makefile: 461; yacc: 328; asm: 205; perl: 203; lex: 146; tcl: 132; javascript: 98; csh: 81
file content (123 lines) | stat: -rwxr-xr-x 3,293 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
#!/bin/bash
# \author Hans J. Johnson
#
# Script to process a directory to remove unnecessary
# backwards compatibility layers for C++11
# options that are now required.
#
#  Step 1 for migration to ITKv5:  Continue building your toolkit with ITKv4, but use  -DITK_FUTURE_LEGACY_REMOVE:BOOL=ON


function ReplaceCXXString()
{
  oldstring="$1"
  newstring="$2"

  git grep -l "${oldstring}" | \
    fgrep -v itk_compiler_detection.h | fgrep -v itkMacro.h | fgrep -v CMakeLists.txt |fgrep -v .cmake | \
    fgrep -v ITKv5Preparation | \
    xargs sed -i '' -e "s/ ${oldstring}/ ${newstring}/g"

  file_changed=$(expr $(git status --porcelain 2>/dev/null| grep "^ M" | wc -l))
  if [[ file_changed -gt 0 ]];then

    cat > /tmp/COMMIT_MSG << EOF
COMP:  Use C++11 ${newstring} directly

git grep -l \"${oldstring}\" | \
  fgrep -v itk_compiler_detection.h | fgrep -v itkMacro.h | fgrep -v CMakeLists.txt |fgrep -v .cmake | \
  xargs sed -i '' -e \"s/ ${oldstring}/ ${newstring}/g\"
EOF
    git add -A
    git commit -F /tmp/COMMIT_MSG

    if [[ $? -ne 0 ]]; then
      echo "ERROR:  COMMIT DID NOT SUCCEED"
      echo "        Fix, then use: git commit -F /tmp/COMMIT_MSG"
      exit -1
    fi
  fi
}

ReplaceCXXString ITK_NOEXCEPT_OR_THROW ITK_NOEXCEPT
ReplaceCXXString ITK_HAS_CXX11_STATIC_ASSERT ITK_COMPILER_CXX_STATIC_ASSERT
ReplaceCXXString ITK_DELETE_FUNCTION ITK_DELETED_FUNCTION
ReplaceCXXString ITK_HAS_CPP11_ALIGNAS ITK_COMPILER_CXX_ALIGNAS


# cxx_nullptr
#    define ITK_NULLPTR nullptr
ReplaceCXXString ITK_NULLPTR nullptr

# cxx_deleted_functions
#    define ITK_DELETED_FUNCTION = delete
ReplaceCXXString ITK_DELETED_FUNCTION "= delete"

# cxx_constexpr
#    define ITK_CONSTEXPR constexpr
#COMP:  Use C++11 constexpr directly
ReplaceCXXString ITK_CONSTEXPR_VAR constexpr
ReplaceCXXString ITK_CONSTEXPR_FUNC constexpr


# cxx_noexcept
ReplaceCXXString ITK_NOEXCEPT noexcept

### --- Other considerations for replacement
# cxx_std_98
# cxx_template_template_parameters
# cxx_std_11
# cxx_alias_templates
# cxx_alignas
# cxx_alignof
# cxx_attributes
# cxx_auto_type
# cxx_decltype
# cxx_decltype_incomplete_return_types
# cxx_default_function_template_args
# cxx_defaulted_functions
# cxx_defaulted_move_initializers
# cxx_delegating_constructors
# cxx_enum_forward_declarations
# cxx_explicit_conversions
# cxx_extended_friend_declarations
# cxx_extern_templates
# cxx_final
# cxx_func_identifier
# cxx_generalized_initializers
# cxx_inheriting_constructors
# cxx_inline_namespaces
# cxx_lambdas
# cxx_local_type_template_args
# cxx_long_long_type
# cxx_nonstatic_member_init
# cxx_override
# cxx_range_for
# cxx_raw_string_literals
# cxx_reference_qualified_functions
# cxx_right_angle_brackets
# cxx_rvalue_references
# cxx_sizeof_member
# cxx_static_assert
# cxx_strong_enums
# cxx_thread_local
# cxx_trailing_return_types
# cxx_unicode_literals
# cxx_uniform_initialization
# cxx_unrestricted_unions
# cxx_user_literals
# cxx_variadic_macros
# cxx_variadic_templates
# cxx_std_14
# cxx_aggregate_default_initializers
# cxx_attribute_deprecated
# cxx_binary_literals
# cxx_contextual_conversions
# cxx_decltype_auto
# cxx_digit_separators
# cxx_generic_lambdas
# cxx_lambda_init_captures
# cxx_relaxed_constexpr
# cxx_return_type_deduction
# cxx_variable_templates
# cxx_std_17