[12/15] Make functions static in unittests

Message ID 20191125052655.22696-13-simon.marchi@efficios.com
State New
Headers show
Series
  • Enable -Wmissing-declarations diagnostic
Related show

Commit Message

Simon Marchi Nov. 25, 2019, 5:26 a.m.
Enabling -Wmissing-declarations points out that a bunch of function in
the unittests can be made static, do that.

gdb/ChangeLog:

	* unittests/array-view-selftests.c (check_ptr_size_ctor2): Make
	static.
	* unittests/basic_string_view/capacity/1.cc (test01): Likewise.
	* unittests/basic_string_view/cons/char/1.cc (test01): Likewise.
	(main): Likewise.
	* unittests/basic_string_view/cons/char/2.cc (test03): Likewise.
	(main): Likewise.
	* unittests/basic_string_view/cons/char/3.cc (test05): Likewise.
	(main): Likewise.
	* unittests/basic_string_view/element_access/char/1.cc (test01): Likewise.
	(main): Likewise.
	* unittests/basic_string_view/element_access/char/empty.cc (main): Likewise.
	* unittests/basic_string_view/element_access/char/front_back.cc (test01): Likewise.
	(main): Likewise.
	* unittests/basic_string_view/inserters/char/2.cc (test05): Likewise.
	(main): Likewise.
	* unittests/basic_string_view/modifiers/remove_prefix/char/1.cc (test01): Likewise.
	(main): Likewise.
	* unittests/basic_string_view/modifiers/remove_suffix/char/1.cc (test01): Likewise.
	(main): Likewise.
	* unittests/basic_string_view/modifiers/swap/char/1.cc (test01): Likewise.
	* unittests/basic_string_view/operations/compare/char/1.cc (test01): Likewise.
	(main): Likewise.
	* unittests/basic_string_view/operations/compare/char/13650.cc (test01): Likewise.
	* unittests/basic_string_view/operations/copy/char/1.cc (test01): Likewise.
	(main): Likewise.
	* unittests/basic_string_view/operations/data/char/1.cc (test01): Likewise.
	(main): Likewise.
	* unittests/basic_string_view/operations/find/char/1.cc (test01): Likewise.
	(main): Likewise.
	* unittests/basic_string_view/operations/find/char/2.cc (test02): Likewise.
	(main): Likewise.
	* unittests/basic_string_view/operations/find/char/3.cc (test03): Likewise.
	(main): Likewise.
	* unittests/basic_string_view/operations/find/char/4.cc (main): Likewise.
	* unittests/basic_string_view/operations/rfind/char/1.cc (test01): Likewise.
	(main): Likewise.
	* unittests/basic_string_view/operations/rfind/char/2.cc (test02): Likewise.
	(main): Likewise.
	* unittests/basic_string_view/operations/rfind/char/3.cc (test03): Likewise.
	(main): Likewise.
	* unittests/basic_string_view/operations/substr/char/1.cc (test01): Likewise.
	(main): Likewise.
	* unittests/basic_string_view/operators/char/2.cc (main): Likewise.
	* unittests/optional/assignment/1.cc (test): Likewise.
	* unittests/optional/assignment/2.cc (test): Likewise.
	* unittests/optional/assignment/3.cc (test): Likewise.
	* unittests/optional/assignment/4.cc (test): Likewise.
	* unittests/optional/assignment/5.cc (test): Likewise.
	* unittests/optional/assignment/6.cc (test): Likewise.
	* unittests/optional/assignment/7.cc (test): Likewise.
	* unittests/optional/cons/copy.cc (test): Likewise.
	* unittests/optional/cons/default.cc (test): Likewise.
	* unittests/optional/cons/move.cc (test): Likewise.
	* unittests/optional/cons/value.cc (test): Likewise.
	* unittests/optional/in_place.cc (test): Likewise.
	* unittests/optional/observers/1.cc (test): Likewise.
	* unittests/optional/observers/2.cc (test): Likewise.

Change-Id: I66626db864cb877cacc570d4660df633530554f5
---
 gdb/unittests/array-view-selftests.c                     | 2 +-
 gdb/unittests/basic_string_view/capacity/1.cc            | 6 +++---
 gdb/unittests/basic_string_view/cons/char/1.cc           | 8 ++++----
 gdb/unittests/basic_string_view/cons/char/2.cc           | 8 ++++----
 gdb/unittests/basic_string_view/cons/char/3.cc           | 8 ++++----
 gdb/unittests/basic_string_view/element_access/char/1.cc | 8 ++++----
 .../basic_string_view/element_access/char/empty.cc       | 4 ++--
 .../basic_string_view/element_access/char/front_back.cc  | 8 ++++----
 gdb/unittests/basic_string_view/inserters/char/2.cc      | 8 ++++----
 .../basic_string_view/modifiers/remove_prefix/char/1.cc  | 8 ++++----
 .../basic_string_view/modifiers/remove_suffix/char/1.cc  | 8 ++++----
 gdb/unittests/basic_string_view/modifiers/swap/char/1.cc | 4 ++--
 .../basic_string_view/operations/compare/char/1.cc       | 8 ++++----
 .../basic_string_view/operations/compare/char/13650.cc   | 6 +++---
 .../basic_string_view/operations/copy/char/1.cc          | 8 ++++----
 .../basic_string_view/operations/data/char/1.cc          | 8 ++++----
 .../basic_string_view/operations/find/char/1.cc          | 8 ++++----
 .../basic_string_view/operations/find/char/2.cc          | 8 ++++----
 .../basic_string_view/operations/find/char/3.cc          | 8 ++++----
 .../basic_string_view/operations/find/char/4.cc          | 6 +++---
 .../basic_string_view/operations/rfind/char/1.cc         | 8 ++++----
 .../basic_string_view/operations/rfind/char/2.cc         | 8 ++++----
 .../basic_string_view/operations/rfind/char/3.cc         | 9 +++++----
 .../basic_string_view/operations/substr/char/1.cc        | 8 ++++----
 gdb/unittests/basic_string_view/operators/char/2.cc      | 6 +++---
 gdb/unittests/optional/assignment/1.cc                   | 3 ++-
 gdb/unittests/optional/assignment/2.cc                   | 3 ++-
 gdb/unittests/optional/assignment/3.cc                   | 3 ++-
 gdb/unittests/optional/assignment/4.cc                   | 3 ++-
 gdb/unittests/optional/assignment/5.cc                   | 3 ++-
 gdb/unittests/optional/assignment/6.cc                   | 3 ++-
 gdb/unittests/optional/assignment/7.cc                   | 3 ++-
 gdb/unittests/optional/cons/copy.cc                      | 3 ++-
 gdb/unittests/optional/cons/default.cc                   | 3 ++-
 gdb/unittests/optional/cons/move.cc                      | 3 ++-
 gdb/unittests/optional/cons/value.cc                     | 3 ++-
 gdb/unittests/optional/in_place.cc                       | 3 ++-
 gdb/unittests/optional/observers/1.cc                    | 3 ++-
 gdb/unittests/optional/observers/2.cc                    | 3 ++-
 39 files changed, 118 insertions(+), 103 deletions(-)

-- 
2.24.0

Patch

diff --git a/gdb/unittests/array-view-selftests.c b/gdb/unittests/array-view-selftests.c
index 8520dfe9a4bb..a6e6d9352ee5 100644
--- a/gdb/unittests/array-view-selftests.c
+++ b/gdb/unittests/array-view-selftests.c
@@ -259,7 +259,7 @@  require_not_constructible ()
 
 /* Check the array_view<T>(PTR, SIZE) ctor, when T is a pointer.  */
 
-void
+static void
 check_ptr_size_ctor2 ()
 {
   struct A {};
diff --git a/gdb/unittests/basic_string_view/capacity/1.cc b/gdb/unittests/basic_string_view/capacity/1.cc
index a55249d083ff..55ee05e73533 100644
--- a/gdb/unittests/basic_string_view/capacity/1.cc
+++ b/gdb/unittests/basic_string_view/capacity/1.cc
@@ -131,8 +131,8 @@  namespace selftests {
 namespace string_view {
 namespace capacity_1 {
 
-void
-test01()
+static void
+test01 ()
 {
   gdb::basic_string_view<A<B>> str02;
   typedef gdb::basic_string_view< A<B> >::size_type size_type_o;
@@ -161,7 +161,7 @@  test01()
   VERIFY( sz03 >= sz04 );
 }
 
-int
+static int
 main()
 {
   test01();
diff --git a/gdb/unittests/basic_string_view/cons/char/1.cc b/gdb/unittests/basic_string_view/cons/char/1.cc
index a7cc8f29d6b9..b5209bd989ca 100644
--- a/gdb/unittests/basic_string_view/cons/char/1.cc
+++ b/gdb/unittests/basic_string_view/cons/char/1.cc
@@ -21,8 +21,8 @@ 
 
 namespace cons_1 {
 
-void
-test01()
+static void
+test01 ()
 {
   typedef gdb::string_view::size_type csize_type;
 
@@ -56,8 +56,8 @@  test01()
   VERIFY( str07.length() == 10 );
 }
 
-int
-main()
+static int
+main ()
 { 
   test01();
 
diff --git a/gdb/unittests/basic_string_view/cons/char/2.cc b/gdb/unittests/basic_string_view/cons/char/2.cc
index 74af38b1b14e..bd7fb6fed441 100644
--- a/gdb/unittests/basic_string_view/cons/char/2.cc
+++ b/gdb/unittests/basic_string_view/cons/char/2.cc
@@ -21,8 +21,8 @@ 
 
 namespace cons_2 {
 
-void
-test03()
+static void
+test03 ()
 {
   const char* with_nulls = "This contains \0 a zero byte.";
 
@@ -35,8 +35,8 @@  test03()
   VERIFY( s2.size() == 28 );
 }
 
-int
-main()
+static int
+main ()
 { 
   test03();
 
diff --git a/gdb/unittests/basic_string_view/cons/char/3.cc b/gdb/unittests/basic_string_view/cons/char/3.cc
index 9e1ca7e67590..8dbaba773503 100644
--- a/gdb/unittests/basic_string_view/cons/char/3.cc
+++ b/gdb/unittests/basic_string_view/cons/char/3.cc
@@ -21,15 +21,15 @@ 
 
 namespace cons_3 {
 
-void
-test05()
+static void
+test05 ()
 {
   char const * s = 0;
   gdb::string_view zero_length_built_with_NULL(s, 0);
 }
 
-int
-main()
+static int
+main ()
 { 
   test05();
 
diff --git a/gdb/unittests/basic_string_view/element_access/char/1.cc b/gdb/unittests/basic_string_view/element_access/char/1.cc
index 59a44b89ab32..ea24cd24345d 100644
--- a/gdb/unittests/basic_string_view/element_access/char/1.cc
+++ b/gdb/unittests/basic_string_view/element_access/char/1.cc
@@ -21,8 +21,8 @@ 
 
 namespace element_access_1 {
 
-void
-test01()
+static void
+test01 ()
 {
   typedef gdb::string_view::size_type csize_type;
   typedef gdb::string_view::const_reference cref;
@@ -60,8 +60,8 @@  test01()
   }
 }
 
-int
-main()
+static int
+main ()
 { 
   test01();
   return 0;
diff --git a/gdb/unittests/basic_string_view/element_access/char/empty.cc b/gdb/unittests/basic_string_view/element_access/char/empty.cc
index 10739404999a..5c322219ca42 100644
--- a/gdb/unittests/basic_string_view/element_access/char/empty.cc
+++ b/gdb/unittests/basic_string_view/element_access/char/empty.cc
@@ -20,8 +20,8 @@ 
 
 namespace element_access_empty {
 
-int
-main()
+static int
+main ()
 {
   {
     gdb::string_view empty;
diff --git a/gdb/unittests/basic_string_view/element_access/char/front_back.cc b/gdb/unittests/basic_string_view/element_access/char/front_back.cc
index 8577ee1251a4..7470336cd02e 100644
--- a/gdb/unittests/basic_string_view/element_access/char/front_back.cc
+++ b/gdb/unittests/basic_string_view/element_access/char/front_back.cc
@@ -20,8 +20,8 @@ 
 
 namespace element_access_front_back {
 
-void
-test01()
+static void
+test01 ()
 {
   gdb::string_view str("ramifications");
   const gdb::string_view cstr("melodien");
@@ -32,8 +32,8 @@  test01()
   VERIFY( cstr.back() == 'n' );
 }
 
-int
-main()
+static int
+main ()
 {
   test01();
 
diff --git a/gdb/unittests/basic_string_view/inserters/char/2.cc b/gdb/unittests/basic_string_view/inserters/char/2.cc
index 3235525c92bf..4d92fa09d045 100644
--- a/gdb/unittests/basic_string_view/inserters/char/2.cc
+++ b/gdb/unittests/basic_string_view/inserters/char/2.cc
@@ -30,8 +30,8 @@  namespace inserters_2 {
 // testing basic_filebuf::xsputn via stress testing with large string_views
 // based on a bug report libstdc++ 9
 // mode == out
-void
-test05(std::size_t size)
+static void
+test05 (std::size_t size)
 {
   bool test ATTRIBUTE_UNUSED = true;
 
@@ -78,8 +78,8 @@  test05(std::size_t size)
   VERIFY( count == 2 * size );
 }
 
-int
-main()
+static int
+main ()
 {
   test05(1); 
   test05(1000); 
diff --git a/gdb/unittests/basic_string_view/modifiers/remove_prefix/char/1.cc b/gdb/unittests/basic_string_view/modifiers/remove_prefix/char/1.cc
index 5c34f8021dbe..7cb93e1437bb 100644
--- a/gdb/unittests/basic_string_view/modifiers/remove_prefix/char/1.cc
+++ b/gdb/unittests/basic_string_view/modifiers/remove_prefix/char/1.cc
@@ -19,8 +19,8 @@ 
 
 namespace modifiers_remove_prefix {
 
-void
-test01()
+static void
+test01 ()
 {
   using gdb::string_view;
 
@@ -52,8 +52,8 @@  test02()
 }
 #endif
 
-int
-main()
+static int
+main ()
 { 
   test01();
 #ifndef GDB_STRING_VIEW
diff --git a/gdb/unittests/basic_string_view/modifiers/remove_suffix/char/1.cc b/gdb/unittests/basic_string_view/modifiers/remove_suffix/char/1.cc
index eb9f73bb7164..97e887e3034e 100644
--- a/gdb/unittests/basic_string_view/modifiers/remove_suffix/char/1.cc
+++ b/gdb/unittests/basic_string_view/modifiers/remove_suffix/char/1.cc
@@ -19,8 +19,8 @@ 
 
 namespace modifiers_remove_suffix {
 
-void
-test01()
+static void
+test01 ()
 {
   using gdb::string_view;
 
@@ -52,8 +52,8 @@  test02()
 }
 #endif
 
-int
-main()
+static int
+main ()
 { 
   test01();
 #ifndef GDB_STRING_VIEW
diff --git a/gdb/unittests/basic_string_view/modifiers/swap/char/1.cc b/gdb/unittests/basic_string_view/modifiers/swap/char/1.cc
index 3a8db925a280..e1b66c6a77fc 100644
--- a/gdb/unittests/basic_string_view/modifiers/swap/char/1.cc
+++ b/gdb/unittests/basic_string_view/modifiers/swap/char/1.cc
@@ -20,8 +20,8 @@ 
 
 namespace modifiers_swap {
 
-void
-test01()
+static void
+test01 ()
 {
   using gdb::string_view;
 
diff --git a/gdb/unittests/basic_string_view/operations/compare/char/1.cc b/gdb/unittests/basic_string_view/operations/compare/char/1.cc
index 273e01e49ad1..44b10663a1f7 100644
--- a/gdb/unittests/basic_string_view/operations/compare/char/1.cc
+++ b/gdb/unittests/basic_string_view/operations/compare/char/1.cc
@@ -61,8 +61,8 @@  test_value(int result, want_value expected)
   return 0;
 }
 
-int
-test01()
+static int
+test01 ()
 {
   using gdb::string_view;
 
@@ -121,8 +121,8 @@  test01()
 }
 
 
-int
-main()
+static int
+main ()
 {
   test01();
 
diff --git a/gdb/unittests/basic_string_view/operations/compare/char/13650.cc b/gdb/unittests/basic_string_view/operations/compare/char/13650.cc
index 69e55687b179..c50d7c221f3c 100644
--- a/gdb/unittests/basic_string_view/operations/compare/char/13650.cc
+++ b/gdb/unittests/basic_string_view/operations/compare/char/13650.cc
@@ -22,8 +22,8 @@ 
 namespace operations_compare_13650 {
 
 // libstdc++/13650
-void
-test01()
+static void
+test01 ()
 {
   using gdb::string_view;
 
@@ -39,7 +39,7 @@  test01()
   VERIFY( str_b.compare(0, 3, lit_02, 5) < 0 );
 }
 
-int
+static int
 main()
 {
   test01();
diff --git a/gdb/unittests/basic_string_view/operations/copy/char/1.cc b/gdb/unittests/basic_string_view/operations/copy/char/1.cc
index 4abc283c63c1..fd829113da47 100644
--- a/gdb/unittests/basic_string_view/operations/copy/char/1.cc
+++ b/gdb/unittests/basic_string_view/operations/copy/char/1.cc
@@ -21,8 +21,8 @@ 
 
 namespace operations_copy_1 {
 
-void
-test01()
+static void
+test01 ()
 {
   typedef gdb::string_view::size_type csize_type;
 
@@ -35,8 +35,8 @@  test01()
   VERIFY( '9' == buffer[0] );
 }
 
-int
-main()
+static int
+main ()
 { 
   test01();
 
diff --git a/gdb/unittests/basic_string_view/operations/data/char/1.cc b/gdb/unittests/basic_string_view/operations/data/char/1.cc
index 1d71fcc44684..0901e4cc95e8 100644
--- a/gdb/unittests/basic_string_view/operations/data/char/1.cc
+++ b/gdb/unittests/basic_string_view/operations/data/char/1.cc
@@ -21,8 +21,8 @@ 
 
 namespace operations_data_1 {
 
-int
-test01()
+static int
+test01 ()
 {
   gdb::string_view empty;
 
@@ -33,8 +33,8 @@  test01()
   return 0;
 }
 
-int
-main()
+static int
+main ()
 { 
   test01();
 
diff --git a/gdb/unittests/basic_string_view/operations/find/char/1.cc b/gdb/unittests/basic_string_view/operations/find/char/1.cc
index fe769eba1c13..ee36cb047941 100644
--- a/gdb/unittests/basic_string_view/operations/find/char/1.cc
+++ b/gdb/unittests/basic_string_view/operations/find/char/1.cc
@@ -21,8 +21,8 @@ 
 
 namespace operations_find_1 {
 
-void
-test01()
+static void
+test01 ()
 {
   typedef gdb::string_view::size_type csize_type;
   typedef gdb::string_view::const_reference cref;
@@ -154,8 +154,8 @@  test02()
 }
 #endif
 
-int
-main()
+static int
+main ()
 {
   test01();
 #ifndef GDB_STRING_VIEW
diff --git a/gdb/unittests/basic_string_view/operations/find/char/2.cc b/gdb/unittests/basic_string_view/operations/find/char/2.cc
index 2a220df23965..72ed9c5bd7f3 100644
--- a/gdb/unittests/basic_string_view/operations/find/char/2.cc
+++ b/gdb/unittests/basic_string_view/operations/find/char/2.cc
@@ -21,8 +21,8 @@ 
 
 namespace operations_find_2 {
 
-void
-test02()
+static void
+test02 ()
 {
   typedef gdb::string_view::size_type csize_type;
   csize_type npos = gdb::string_view::npos;
@@ -152,8 +152,8 @@  test03()
 }
 #endif
 
-int
-main()
+static int
+main ()
 {
   test02();
 #ifndef GDB_STRING_VIEW
diff --git a/gdb/unittests/basic_string_view/operations/find/char/3.cc b/gdb/unittests/basic_string_view/operations/find/char/3.cc
index b47daadc02fb..3995c07f7535 100644
--- a/gdb/unittests/basic_string_view/operations/find/char/3.cc
+++ b/gdb/unittests/basic_string_view/operations/find/char/3.cc
@@ -21,8 +21,8 @@ 
 
 namespace operations_find_3 {
 
-void
-test03()
+static void
+test03 ()
 {
   typedef gdb::string_view::size_type csize_type;
   csize_type npos = gdb::string_view::npos;
@@ -152,8 +152,8 @@  test04()
 }
 #endif
 
-int
-main()
+static int
+main ()
 {
   test03();
 #ifndef GDB_STRING_VIEW
diff --git a/gdb/unittests/basic_string_view/operations/find/char/4.cc b/gdb/unittests/basic_string_view/operations/find/char/4.cc
index 17f186205622..75b04a429d39 100644
--- a/gdb/unittests/basic_string_view/operations/find/char/4.cc
+++ b/gdb/unittests/basic_string_view/operations/find/char/4.cc
@@ -22,7 +22,7 @@ 
 namespace operations_find_4 {
 
 // libstdc++/31401
-void
+static void
 test01()
 {
   typedef gdb::string_view::size_type csize_type;
@@ -34,8 +34,8 @@  test01()
   VERIFY( pos1 == npos );
 }
 
-int
-main()
+static int
+main ()
 {
   test01();
 
diff --git a/gdb/unittests/basic_string_view/operations/rfind/char/1.cc b/gdb/unittests/basic_string_view/operations/rfind/char/1.cc
index 7a634f4c170b..11fa0d775283 100644
--- a/gdb/unittests/basic_string_view/operations/rfind/char/1.cc
+++ b/gdb/unittests/basic_string_view/operations/rfind/char/1.cc
@@ -21,8 +21,8 @@  namespace operations_rfind_1 {
 
 // basic_string_view rfind
 
-void
-test01()
+static void
+test01 ()
 {
   typedef gdb::string_view::size_type csize_type;
   typedef gdb::string_view::const_reference cref;
@@ -84,8 +84,8 @@  test01()
   VERIFY( csz01 == npos );
 }
 
-int
-main()
+static int
+main ()
 {
   test01();
 
diff --git a/gdb/unittests/basic_string_view/operations/rfind/char/2.cc b/gdb/unittests/basic_string_view/operations/rfind/char/2.cc
index d4e8561b394d..aa99d0ee4ec6 100644
--- a/gdb/unittests/basic_string_view/operations/rfind/char/2.cc
+++ b/gdb/unittests/basic_string_view/operations/rfind/char/2.cc
@@ -21,8 +21,8 @@  namespace operations_rfind_2 {
 
 // basic_string_view::find_last_of
 
-void
-test02()
+static void
+test02 ()
 {
   gdb::string_view z("ab");
   gdb::string_view::size_type pos;
@@ -42,8 +42,8 @@  test02()
   VERIFY( pos == gdb::string_view::npos );
 }
 
-int
-main()
+static int
+main ()
 {
   test02();
 
diff --git a/gdb/unittests/basic_string_view/operations/rfind/char/3.cc b/gdb/unittests/basic_string_view/operations/rfind/char/3.cc
index 4d375567a18d..989814c4ac7d 100644
--- a/gdb/unittests/basic_string_view/operations/rfind/char/3.cc
+++ b/gdb/unittests/basic_string_view/operations/rfind/char/3.cc
@@ -21,8 +21,8 @@  namespace operations_rfind_3 {
 
 // basic_string_view::find_last_not_of
 
-void
-test03()
+static void
+test03 ()
 {
   typedef gdb::string_view::size_type csize_type;
   gdb::string_view::size_type pos;
@@ -56,8 +56,9 @@  test03()
   pos = z.find_last_not_of("Xa");
   VERIFY( pos == 1 );
 }
-int
-main()
+
+static int
+main ()
 {
   test03();
 
diff --git a/gdb/unittests/basic_string_view/operations/substr/char/1.cc b/gdb/unittests/basic_string_view/operations/substr/char/1.cc
index b732204a475a..a95173ac7666 100644
--- a/gdb/unittests/basic_string_view/operations/substr/char/1.cc
+++ b/gdb/unittests/basic_string_view/operations/substr/char/1.cc
@@ -21,8 +21,8 @@ 
 
 namespace operations_substr_1 {
 
-void
-test01()
+static void
+test01 ()
 {
   typedef gdb::string_view::size_type csize_type;
   typedef gdb::string_view::const_reference cref;
@@ -68,8 +68,8 @@  test01()
   }
 }
 
-int
-main()
+static int
+main ()
 { 
   test01();
 
diff --git a/gdb/unittests/basic_string_view/operators/char/2.cc b/gdb/unittests/basic_string_view/operators/char/2.cc
index 38aa3c2b68bf..281d7daeb7eb 100644
--- a/gdb/unittests/basic_string_view/operators/char/2.cc
+++ b/gdb/unittests/basic_string_view/operators/char/2.cc
@@ -111,7 +111,7 @@  template<class charT, class traits, class Allocator>
 
 namespace operators_2 {
 
-void
+static void
 test01()
 {
   gdb::string_view 	str_0("costa rica");
@@ -360,8 +360,8 @@  test02()
 }
 #endif
 
-int
-main()
+static int
+main ()
 {
   test01();
 #ifndef GDB_STRING_VIEW
diff --git a/gdb/unittests/optional/assignment/1.cc b/gdb/unittests/optional/assignment/1.cc
index 852464732bb6..f17468cbf488 100644
--- a/gdb/unittests/optional/assignment/1.cc
+++ b/gdb/unittests/optional/assignment/1.cc
@@ -92,7 +92,8 @@  struct value_type : private mixin_counter
   state_type state = zero;
 };
 
-void test()
+static void
+test ()
 {
   using O = gdb::optional<value_type>;
   using S = value_type::state_type;
diff --git a/gdb/unittests/optional/assignment/2.cc b/gdb/unittests/optional/assignment/2.cc
index 8c916022133b..9964d57a5ee0 100644
--- a/gdb/unittests/optional/assignment/2.cc
+++ b/gdb/unittests/optional/assignment/2.cc
@@ -92,7 +92,8 @@  struct value_type : private mixin_counter
   state_type state = zero;
 };
 
-void test()
+static void
+test ()
 {
   using O = gdb::optional<value_type>;
   using S = value_type::state_type;
diff --git a/gdb/unittests/optional/assignment/3.cc b/gdb/unittests/optional/assignment/3.cc
index 2957a29a797b..2fbab478873f 100644
--- a/gdb/unittests/optional/assignment/3.cc
+++ b/gdb/unittests/optional/assignment/3.cc
@@ -92,7 +92,8 @@  struct value_type : private mixin_counter
   state_type state = zero;
 };
 
-void test()
+static void
+test ()
 {
   using O = gdb::optional<value_type>;
   using S = value_type::state_type;
diff --git a/gdb/unittests/optional/assignment/4.cc b/gdb/unittests/optional/assignment/4.cc
index 98ea03d99be3..d86bc03c92d9 100644
--- a/gdb/unittests/optional/assignment/4.cc
+++ b/gdb/unittests/optional/assignment/4.cc
@@ -92,7 +92,8 @@  struct value_type : private mixin_counter
   state_type state = zero;
 };
 
-void test()
+static void
+test ()
 {
   using O = gdb::optional<value_type>;
   using S = value_type::state_type;
diff --git a/gdb/unittests/optional/assignment/5.cc b/gdb/unittests/optional/assignment/5.cc
index 3a7bd33f31e6..b7b8d61c639c 100644
--- a/gdb/unittests/optional/assignment/5.cc
+++ b/gdb/unittests/optional/assignment/5.cc
@@ -28,7 +28,8 @@  struct mixin_counter
 
 struct value_type : private mixin_counter { };
 
-void test()
+static void
+test ()
 {
   using O = gdb::optional<value_type>;
 
diff --git a/gdb/unittests/optional/assignment/6.cc b/gdb/unittests/optional/assignment/6.cc
index cea59946ed9d..3c1e246704fa 100644
--- a/gdb/unittests/optional/assignment/6.cc
+++ b/gdb/unittests/optional/assignment/6.cc
@@ -34,7 +34,8 @@  struct value_type : private mixin_counter
   int state = 0;
 };
 
-void test()
+static void
+test ()
 {
   using O = gdb::optional<value_type>;
 
diff --git a/gdb/unittests/optional/assignment/7.cc b/gdb/unittests/optional/assignment/7.cc
index 76a47eb17c25..5e7367086542 100644
--- a/gdb/unittests/optional/assignment/7.cc
+++ b/gdb/unittests/optional/assignment/7.cc
@@ -17,7 +17,8 @@ 
 
 namespace assign_7 {
 
-void test()
+static void
+test ()
 {
   gdb::optional<int> o{666};
   VERIFY(o && *o == 666);
diff --git a/gdb/unittests/optional/cons/copy.cc b/gdb/unittests/optional/cons/copy.cc
index 28bfce84df88..af8b56ea87a5 100644
--- a/gdb/unittests/optional/cons/copy.cc
+++ b/gdb/unittests/optional/cons/copy.cc
@@ -47,7 +47,8 @@  struct throwing_copy
   throwing_copy(throwing_copy const&) { throw exception {}; }
 };
 
-void test()
+static void
+test ()
 {
   // [20.5.4.1] Constructors
 
diff --git a/gdb/unittests/optional/cons/default.cc b/gdb/unittests/optional/cons/default.cc
index 828fa26886da..54c4bf7c7655 100644
--- a/gdb/unittests/optional/cons/default.cc
+++ b/gdb/unittests/optional/cons/default.cc
@@ -33,7 +33,8 @@  struct tracker
 
 int tracker::count = 0;
 
-void test()
+static void
+test ()
 {
   // [20.5.4.1] Constructors
 
diff --git a/gdb/unittests/optional/cons/move.cc b/gdb/unittests/optional/cons/move.cc
index 0cfa5397a6ec..cf363f411fc1 100644
--- a/gdb/unittests/optional/cons/move.cc
+++ b/gdb/unittests/optional/cons/move.cc
@@ -47,7 +47,8 @@  struct throwing_move
   throwing_move(throwing_move const&) { throw exception {}; }
 };
 
-void test()
+static void
+test ()
 {
   // [20.5.4.1] Constructors
 
diff --git a/gdb/unittests/optional/cons/value.cc b/gdb/unittests/optional/cons/value.cc
index e47b367b1882..23f546ed4c02 100644
--- a/gdb/unittests/optional/cons/value.cc
+++ b/gdb/unittests/optional/cons/value.cc
@@ -55,7 +55,8 @@  struct throwing_construction
   bool propagate;
 };
 
-void test()
+static void
+test ()
 {
   // [20.5.4.1] Constructors
 
diff --git a/gdb/unittests/optional/in_place.cc b/gdb/unittests/optional/in_place.cc
index 6387be49e591..d751abe219f8 100644
--- a/gdb/unittests/optional/in_place.cc
+++ b/gdb/unittests/optional/in_place.cc
@@ -17,7 +17,8 @@ 
 
 namespace in_place {
 
-void test()
+static void
+test ()
 {
   // [20.5.5] In-place construction
   {
diff --git a/gdb/unittests/optional/observers/1.cc b/gdb/unittests/optional/observers/1.cc
index 42a771975bec..368c42d514c4 100644
--- a/gdb/unittests/optional/observers/1.cc
+++ b/gdb/unittests/optional/observers/1.cc
@@ -22,7 +22,8 @@  struct value_type
   int i;
 };
 
-void test()
+static void
+test ()
 {
   gdb::optional<value_type> o { value_type { 51 } };
   VERIFY( (*o).i == 51 );
diff --git a/gdb/unittests/optional/observers/2.cc b/gdb/unittests/optional/observers/2.cc
index cc28c0bc9a96..e259b2b546b3 100644
--- a/gdb/unittests/optional/observers/2.cc
+++ b/gdb/unittests/optional/observers/2.cc
@@ -24,7 +24,8 @@  struct value_type
 
 void* operator&(const value_type&) = delete;
 
-void test()
+static void
+test ()
 {
   gdb::optional<value_type> o { value_type { 51 } };
   VERIFY( o->i == 51 );