diff --git a/aegisub/libaegisub/common/hotkey.cpp b/aegisub/libaegisub/common/hotkey.cpp
index be9e345a3..a285fb378 100644
--- a/aegisub/libaegisub/common/hotkey.cpp
+++ b/aegisub/libaegisub/common/hotkey.cpp
@@ -21,8 +21,7 @@
 #include "../config.h"
 
 #ifndef LAGI_PRE
-#include <math.h>
-
+#include <cmath>
 #include <memory>
 #endif
 
diff --git a/aegisub/libaegisub/common/log.cpp b/aegisub/libaegisub/common/log.cpp
index 1f76b6e5f..56b2b8126 100644
--- a/aegisub/libaegisub/common/log.cpp
+++ b/aegisub/libaegisub/common/log.cpp
@@ -18,11 +18,10 @@
 /// @brief Logging
 /// @ingroup libaegisub
 
-#ifndef AGI_PRE
-#include <stdio.h>
-#include <string.h>
-
+#ifndef LAGI_PRE
 #include <algorithm>
+#include <cstdio>
+#include <cstring>
 #include <functional>
 #include <memory>
 #endif
diff --git a/aegisub/libaegisub/common/option_visit.cpp b/aegisub/libaegisub/common/option_visit.cpp
index 77d378f6f..868b97ca6 100644
--- a/aegisub/libaegisub/common/option_visit.cpp
+++ b/aegisub/libaegisub/common/option_visit.cpp
@@ -20,8 +20,7 @@
 /// @ingroup libaegisub
 
 #ifndef LAGI_PRE
-#include <math.h>
-
+#include <cmath>
 #include <memory>
 #endif
 
diff --git a/aegisub/libaegisub/common/util.cpp b/aegisub/libaegisub/common/util.cpp
index 6fd2d32ad..355a5d735 100644
--- a/aegisub/libaegisub/common/util.cpp
+++ b/aegisub/libaegisub/common/util.cpp
@@ -20,9 +20,9 @@
 
 #ifndef LAGI_PRE
 #include <errno.h>
-#include <stdio.h>
 
 #include <climits>
+#include <cstdio>
 #include <locale>
 #endif
 
diff --git a/aegisub/libaegisub/common/validator.cpp b/aegisub/libaegisub/common/validator.cpp
index 24e8568e7..0fefa27f7 100644
--- a/aegisub/libaegisub/common/validator.cpp
+++ b/aegisub/libaegisub/common/validator.cpp
@@ -18,9 +18,6 @@
 /// @brief Input validation.
 /// @ingroup libaegisub
 
-#ifndef LAGI_PRE
-#endif
-
 #include <libaegisub/validator.h>
 
 namespace agi {
diff --git a/aegisub/libaegisub/config.h b/aegisub/libaegisub/config.h
index aa1293d24..8783afd83 100644
--- a/aegisub/libaegisub/config.h
+++ b/aegisub/libaegisub/config.h
@@ -1,4 +1,4 @@
-#if !defined(AGI_PRE) && !defined(LAGI_PRE)
+#ifndef LAGI_PRE
 
 #ifdef _WIN32 // Windows specific settings
 #define HAVE_PTHREAD 1
diff --git a/aegisub/libaegisub/include/libaegisub/access.h b/aegisub/libaegisub/include/libaegisub/access.h
index 13f87b57d..3a7b819d7 100644
--- a/aegisub/libaegisub/include/libaegisub/access.h
+++ b/aegisub/libaegisub/include/libaegisub/access.h
@@ -18,9 +18,6 @@
 /// @brief Public interface for access methods.
 /// @ingroup libaegisub
 
-#ifndef LAGI_PRE
-#endif
-
 #include <libaegisub/exception.h>
 
 namespace agi {
diff --git a/aegisub/libaegisub/include/libaegisub/charset_conv.h b/aegisub/libaegisub/include/libaegisub/charset_conv.h
index 6daf23946..4a4dc1862 100644
--- a/aegisub/libaegisub/include/libaegisub/charset_conv.h
+++ b/aegisub/libaegisub/include/libaegisub/charset_conv.h
@@ -21,7 +21,7 @@
 #pragma once
 
 #ifndef LAGI_PRE
-#include <string.h>
+#include <cstring>
 #include <memory>
 #include <string>
 #include <vector>
diff --git a/aegisub/libaegisub/include/libaegisub/hotkey.h b/aegisub/libaegisub/include/libaegisub/hotkey.h
index 1a8046471..cadc9a4e6 100644
--- a/aegisub/libaegisub/include/libaegisub/hotkey.h
+++ b/aegisub/libaegisub/include/libaegisub/hotkey.h
@@ -19,8 +19,7 @@
 /// @ingroup hotkey menu event window
 
 #ifndef LAGI_PRE
-#include <math.h>
-
+#include <cmath>
 #include <map>
 #include <memory>
 #include <string>
diff --git a/aegisub/libaegisub/include/libaegisub/keyframe.h b/aegisub/libaegisub/include/libaegisub/keyframe.h
index 881d7296a..eb7a23c28 100644
--- a/aegisub/libaegisub/include/libaegisub/keyframe.h
+++ b/aegisub/libaegisub/include/libaegisub/keyframe.h
@@ -19,7 +19,7 @@
 /// @ingroup libaegisub
 ///
 
-#if !defined(AGI_PRE) && !defined(LAGI_PRE)
+#ifndef LAGI_PRE
 #include <vector>
 #endif
 
diff --git a/aegisub/libaegisub/include/libaegisub/line_iterator.h b/aegisub/libaegisub/include/libaegisub/line_iterator.h
index fe9c42743..eef2e21b2 100644
--- a/aegisub/libaegisub/include/libaegisub/line_iterator.h
+++ b/aegisub/libaegisub/include/libaegisub/line_iterator.h
@@ -20,7 +20,7 @@
 
 #pragma once
 
-#if !defined(AGI_PRE) && !defined(LAGI_PRE)
+#ifndef LAGI_PRE
 #include <iterator>
 #ifdef _WIN32
 #include <memory>
diff --git a/aegisub/libaegisub/include/libaegisub/log.h b/aegisub/libaegisub/include/libaegisub/log.h
index 26d7c53b5..6a32c10f7 100644
--- a/aegisub/libaegisub/include/libaegisub/log.h
+++ b/aegisub/libaegisub/include/libaegisub/log.h
@@ -19,10 +19,10 @@
 /// @ingroup libaegisub
 
 #ifndef LAGI_PRE
-#include <stdio.h>
 #include <stdint.h>
-#include <time.h>
 
+#include <cstdio>
+#include <ctime>
 #include <deque>
 #include <memory>
 #ifdef __DEPRECATED // Dodge GCC warnings
@@ -34,7 +34,6 @@
 #endif
 #include <vector>
 #endif
-//#include <libaegisub/exception.h>
 #include <libaegisub/types.h>
 
 // These macros below aren't a perm solution, it will depend on how annoying they are through
diff --git a/aegisub/libaegisub/include/libaegisub/option_value.h b/aegisub/libaegisub/include/libaegisub/option_value.h
index 9f56538bf..2156e1f7b 100644
--- a/aegisub/libaegisub/include/libaegisub/option_value.h
+++ b/aegisub/libaegisub/include/libaegisub/option_value.h
@@ -18,7 +18,7 @@
 /// @brief Container for holding an actual option value.
 /// @ingroup libaegisub
 
-#if !defined(AGI_PRE) && !defined(LAGI_PRE)
+#ifndef LAGI_PRE
 #include <stdint.h>
 
 #include <fstream>
diff --git a/aegisub/libaegisub/include/libaegisub/path.h b/aegisub/libaegisub/include/libaegisub/path.h
index 6b1462ed2..82f5064b7 100644
--- a/aegisub/libaegisub/include/libaegisub/path.h
+++ b/aegisub/libaegisub/include/libaegisub/path.h
@@ -18,9 +18,6 @@
 /// @brief Common paths.
 /// @ingroup libaegisub
 
-#ifndef AGI_PRE
-#endif
-
 #include <libaegisub/exception.h>
 #include <libaegisub/scoped_ptr.h>
 
diff --git a/aegisub/libaegisub/include/libaegisub/signal.h b/aegisub/libaegisub/include/libaegisub/signal.h
index d5124b97d..9da6e5c20 100644
--- a/aegisub/libaegisub/include/libaegisub/signal.h
+++ b/aegisub/libaegisub/include/libaegisub/signal.h
@@ -20,7 +20,7 @@
 
 #pragma once
 
-#if !defined(AGI_PRE) && !defined(LAGI_PRE)
+#ifndef LAGI_PRE
 #ifdef _WIN32
 #include <functional>
 #include <map>
diff --git a/aegisub/libaegisub/include/libaegisub/validator.h b/aegisub/libaegisub/include/libaegisub/validator.h
index f8b644049..8734025e5 100644
--- a/aegisub/libaegisub/include/libaegisub/validator.h
+++ b/aegisub/libaegisub/include/libaegisub/validator.h
@@ -18,14 +18,10 @@
 /// @brief Input validation.
 /// @ingroup libaegisub
 
-#ifndef LAGI_PRE
-#endif
-
 #include <libaegisub/colour.h>
 
 namespace agi {
 
-
 class Validator {
 public:
 	/// Types supported.
diff --git a/aegisub/libaegisub/include/libaegisub/vfr.h b/aegisub/libaegisub/include/libaegisub/vfr.h
index 0574cf269..9ab878bd0 100644
--- a/aegisub/libaegisub/include/libaegisub/vfr.h
+++ b/aegisub/libaegisub/include/libaegisub/vfr.h
@@ -20,7 +20,7 @@
 
 #pragma once
 
-#if !defined(AGI_PRE) && !defined(LAGI_PRE)
+#ifndef LAGI_PRE
 #include <string>
 #include <vector>
 #endif