← Back to team overview

widelands-dev team mailing list archive

[Merge] lp:~widelands-dev/widelands/compiler_warnings_clang_201902 into lp:widelands

 

GunChleoc has proposed merging lp:~widelands-dev/widelands/compiler_warnings_clang_201902 into lp:widelands.

Commit message:
Fix clang compiler warnings

Requested reviews:
  Widelands Developers (widelands-dev)

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/compiler_warnings_clang_201902/+merge/363580
-- 
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/compiler_warnings_clang_201902 into lp:widelands.
=== modified file 'src/graphic/gl/initialize.cc'
--- src/graphic/gl/initialize.cc	2018-10-16 19:18:11 +0000
+++ src/graphic/gl/initialize.cc	2019-02-23 14:01:57 +0000
@@ -200,7 +200,7 @@
 			SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "OpenGL Error",
 			                         "Widelands won’t work because your graphics driver is too old.\n"
 			                         "The shading language needs to be version 1.20 or newer.",
-			                         NULL);
+			                         nullptr);
 			exit(1);
 		}
 	} else {
@@ -215,7 +215,7 @@
 				   SDL_MESSAGEBOX_ERROR, "OpenGL Error",
 				   "Widelands won’t work because your graphics driver is too old.\n"
 				   "The shading language needs to be version 1.20 or newer.",
-				   NULL);
+				   nullptr);
 				exit(1);
 			}
 		} else {
@@ -227,7 +227,7 @@
 			   "Widelands won't work because we were unable to detect the shading "
 			   "language version.\nThere is an unknown problem with reading the "
 			   "information from the graphics driver.",
-			   NULL);
+			   nullptr);
 			exit(1);
 		}
 	}

=== modified file 'src/logic/generic_save_handler.cc'
--- src/logic/generic_save_handler.cc	2019-02-23 08:39:11 +0000
+++ src/logic/generic_save_handler.cc	2019-02-23 14:01:57 +0000
@@ -91,8 +91,8 @@
 		error_ |= Error::kBackupFailed;
 		uint32_t index = get_index(Error::kBackupFailed);
 		error_msg_[index] = (boost::format("GenericSaveHandler::make_backup: file %s "
-		                                   "could not be renamed: %s\n") %
-		                     complete_filename_.c_str() % backup_filename_)
+		                                   "could not be renamed to %s: %s\n") %
+		                     complete_filename_.c_str() % backup_filename_ % e.what())
 		                       .str();
 		log("%s", error_msg_[index].c_str());
 		return;

=== modified file 'src/logic/generic_save_handler.h'
--- src/logic/generic_save_handler.h	2019-02-23 08:39:11 +0000
+++ src/logic/generic_save_handler.h	2019-02-23 14:01:57 +0000
@@ -63,8 +63,7 @@
 	     dir_(FileSystem::fs_dirname(complete_filename.c_str())),
 	     filename_(FileSystem::fs_filename(complete_filename.c_str())),
 	     type_(type),
-	     //     error_(Error::kSuccess) {};
-	     error_(static_cast<Error>(1132)){};
+	     error_(static_cast<Error>(1132)) {}
 
 	/**
 	 * Tries to save a file.
@@ -82,7 +81,7 @@
 	// returns the stored error code (of the last saving operation)
 	Error error() {
 		return error_;
-	};
+	}
 
 	// Returns the combination of error_messages (of occurred errors)
 	// specified by a bit mask.

=== modified file 'src/website/json/json.h'
--- src/website/json/json.h	2019-02-09 11:20:38 +0000
+++ src/website/json/json.h	2019-02-23 14:01:57 +0000
@@ -43,6 +43,7 @@
 	// Constructor for root node
 	explicit Element() : JSON::Element("", 0) {
 	}
+	virtual ~Element() = default;
 
 	JSON::Object* add_object(const std::string& key = "");
 	JSON::Array* add_array(const std::string& key);

=== modified file 'src/website/json/value.h'
--- src/website/json/value.h	2019-02-09 11:20:38 +0000
+++ src/website/json/value.h	2019-02-23 14:01:57 +0000
@@ -27,7 +27,9 @@
 /// Value types for JSON
 struct Value {
 	Value() = default;
+	virtual ~Value() = default;
 	virtual std::string as_string() const = 0;
+
 };
 
 struct Boolean : Value {

=== modified file 'src/wlapplication.cc'
--- src/wlapplication.cc	2019-02-23 08:39:11 +0000
+++ src/wlapplication.cc	2019-02-23 14:01:57 +0000
@@ -1494,7 +1494,7 @@
 				g_fs->fs_unlink(filename);
 			} catch (const FileError& e) {
 				log(
-				   "WLApplication::cleanup_ai_files: File %s couldn't be deleted.\n", filename.c_str());
+				   "WLApplication::cleanup_ai_files: File %s couldn't be deleted: %s\n", filename.c_str(), e.what());
 			}
 		}
 	}
@@ -1512,8 +1512,8 @@
 			try {
 				g_fs->fs_unlink(filename);
 			} catch (const FileError& e) {
-				log("WLApplication::cleanup_temp_files: File %s couldn't be deleted.\n",
-				    filename.c_str());
+				log("WLApplication::cleanup_temp_files: File %s couldn't be deleted: %s\n",
+				    filename.c_str(), e.what());
 			}
 		}
 	}
@@ -1531,8 +1531,8 @@
 			try {
 				g_fs->fs_unlink(filename);
 			} catch (const FileError& e) {
-				log("WLApplication::cleanup_temp_backups: File %s couldn't be deleted.\n",
-				    filename.c_str());
+				log("WLApplication::cleanup_temp_backups: File %s couldn't be deleted: %s\n",
+				    filename.c_str(), e.what());
 			}
 		}
 	}


Follow ups