dblume commited on 2022-04-08 11:46:34
Showing 11 changed files, with 37 additions and 19 deletions.
See https://vimhelp.org/usr_29.txt.html#:~:text=MOVING%20IN%20CODE%20BLOCKS
... | ... |
@@ -1,7 +1,8 @@ |
1 | 1 |
#/bin/bash |
2 | 2 |
set -eu -o pipefail # See: https://sipb.mit.edu/doc/safe-shell/ |
3 | 3 |
|
4 |
-ctags -n --if0=yes --langmap=c++:+.inl --c++-kinds=+p -R --extra=q \ |
|
4 |
+# Add flag --c++-kinds=+p for tags to declaration in .h files too. |
|
5 |
+ctags -n --if0=yes --langmap=c++:+.inl -R --extra=q \ |
|
5 | 6 |
--exclude=.git \ |
6 | 7 |
--exclude=obj \ |
7 | 8 |
--exclude=lib \ |
... | ... |
@@ -16,7 +17,7 @@ find . -mindepth 1 \ |
16 | 17 |
-or -type d -print | while read i |
17 | 18 |
do |
18 | 19 |
pushd "$i" 1> /dev/null |
19 |
- ctags -n --if0=yes --langmap=c++:+.inl --c++-kinds=+p -R --extra=q \ |
|
20 |
+ ctags -n --if0=yes --langmap=c++:+.inl -R --extra=q \ |
|
20 | 21 |
--exclude=obj \ |
21 | 22 |
--exclude='*generated/*' |
22 | 23 |
popd 1> /dev/null |
... | ... |
@@ -3,7 +3,8 @@ |
3 | 3 |
|
4 | 4 |
using namespace std; |
5 | 5 |
|
6 |
-namespace { |
|
6 |
+namespace |
|
7 |
+{ |
|
7 | 8 |
|
8 | 9 |
int my_lib_helper_fn(int x) { |
9 | 10 |
cout << "The function " << __func__ << " with parameter " << x << " was called." << endl; |
... | ... |
@@ -24,12 +25,14 @@ int my_lib_rect::area() const |
24 | 25 |
return width_ * height_; |
25 | 26 |
} |
26 | 27 |
|
27 |
-int my_lib_fn() { |
|
28 |
+int my_lib_fn() |
|
29 |
+{ |
|
28 | 30 |
cout << "The function " << __func__ << " was called." << endl; |
29 | 31 |
return 0; |
30 | 32 |
} |
31 | 33 |
|
32 |
-int my_lib_fn(int x) { |
|
34 |
+int my_lib_fn(int x) |
|
35 |
+{ |
|
33 | 36 |
int a = my_lib_helper_fn(x); |
34 | 37 |
cout << "The function " << __PRETTY_FUNCTION__ << " with parameter " << x << " was called." << endl; |
35 | 38 |
return x + a; |
... | ... |
@@ -57,7 +57,8 @@ int remove_duplicates(int a[], int n) |
57 | 57 |
return last + 1; |
58 | 58 |
} |
59 | 59 |
|
60 |
-void test_cpp14() { |
|
60 |
+void test_cpp14() |
|
61 |
+{ |
|
61 | 62 |
#if __cplusplus == 201402L |
62 | 63 |
// Store a generalized lambda, that squares a number, in a variable |
63 | 64 |
auto func = [](auto input) { return input * input; }; |
... | ... |
@@ -73,17 +74,20 @@ void test_cpp14() { |
73 | 74 |
#endif |
74 | 75 |
} |
75 | 76 |
|
76 |
-struct Base { |
|
77 |
+struct Base |
|
78 |
+{ |
|
77 | 79 |
virtual ~Base() {} |
78 | 80 |
virtual void f() {} |
79 | 81 |
int x_; |
80 | 82 |
}; |
81 | 83 |
|
82 |
-struct Derived: Base { |
|
84 |
+struct Derived: Base |
|
85 |
+{ |
|
83 | 86 |
virtual void name() {} |
84 | 87 |
}; |
85 | 88 |
|
86 |
-int main() { |
|
89 |
+int main() |
|
90 |
+{ |
|
87 | 91 |
length_of_array = 6; |
88 | 92 |
int a[6] = { 10, 20, 20, 30, 40, 40 }; |
89 | 93 |
int item_to_remove = 20; |
... | ... |
@@ -11,7 +11,8 @@ int read( std::string const &directory, const std::vector<unsigned char> &secret |
11 | 11 |
return directory.length(); |
12 | 12 |
} |
13 | 13 |
|
14 |
-int main_helper_fn() { |
|
14 |
+int main_helper_fn() |
|
15 |
+{ |
|
15 | 16 |
cout << "The function " << __PRETTY_FUNCTION__ << " was called." << endl; |
16 | 17 |
string my_string("Hello"); |
17 | 18 |
vector<unsigned char> secret; |
... | ... |
@@ -9,17 +9,20 @@ namespace { |
9 | 9 |
std::set<scoped_set_adder *> g_items; |
10 | 10 |
} |
11 | 11 |
|
12 |
-scoped_set_adder::scoped_set_adder(std::string const& name) : name_(name) { |
|
12 |
+scoped_set_adder::scoped_set_adder(std::string const& name) : name_(name) |
|
13 |
+{ |
|
13 | 14 |
std::lock_guard<std::mutex> lock(g_mutex); |
14 | 15 |
g_items.insert(this); |
15 | 16 |
} |
16 | 17 |
|
17 |
-scoped_set_adder::~scoped_set_adder() { |
|
18 |
+scoped_set_adder::~scoped_set_adder() |
|
19 |
+{ |
|
18 | 20 |
std::lock_guard<std::mutex> lock(g_mutex); |
19 | 21 |
g_items.erase(this); |
20 | 22 |
} |
21 | 23 |
|
22 |
-bool scoped_set_adder::dump() { |
|
24 |
+bool scoped_set_adder::dump() |
|
25 |
+{ |
|
23 | 26 |
std::lock_guard<std::mutex> lock(g_mutex); |
24 | 27 |
bool ret = (g_items.size() > 0); |
25 | 28 |
std::cout << "Scoped sets exist: " << ret << ", count: " << g_items.size() << std::endl; |