diff --git a/test/clear_system_state.h b/test/clear_system_state.h
index 8f08a4cdb583801812ca024ae7bc406171deb4c9..5e767974431a130173a001f7087ac90453575f7c 100644
--- a/test/clear_system_state.h
+++ b/test/clear_system_state.h
@@ -11,11 +11,9 @@
 #define TEST_CLEAR_SYSTEM_STATE_H_
 
 #include "./vpx_config.h"
-extern "C" {
 #if ARCH_X86 || ARCH_X86_64
 # include "vpx_ports/x86.h"
 #endif
-}
 
 namespace libvpx_test {
 
diff --git a/test/convolve_test.cc b/test/convolve_test.cc
index 9ab60b1c3552f0ea82c9b5354a374c2e839dfa33..e920de874167dfb3752b93c43591ed2e85c0c4d8 100644
--- a/test/convolve_test.cc
+++ b/test/convolve_test.cc
@@ -14,13 +14,11 @@
 #include "test/util.h"
 #include "third_party/googletest/src/include/gtest/gtest.h"
 
-extern "C" {
 #include "./vpx_config.h"
 #include "./vp9_rtcd.h"
 #include "vp9/common/vp9_filter.h"
 #include "vpx_mem/vpx_mem.h"
 #include "vpx_ports/mem.h"
-}
 
 namespace {
 typedef void (*convolve_fn_t)(const uint8_t *src, ptrdiff_t src_stride,
diff --git a/test/dct16x16_test.cc b/test/dct16x16_test.cc
index 5496d0b62676fec4b895fb6d23d2484fa6ab4ab2..ce0431860c2da67e9658e596098eb3c58d3808d1 100644
--- a/test/dct16x16_test.cc
+++ b/test/dct16x16_test.cc
@@ -18,12 +18,13 @@
 #include "test/register_state_check.h"
 #include "test/util.h"
 
-extern "C" {
-#include "vp9/common/vp9_entropy.h"
 #include "./vp9_rtcd.h"
+#include "vp9/common/vp9_entropy.h"
+#include "vpx/vpx_integer.h"
+
+extern "C" {
 void vp9_idct16x16_256_add_c(const int16_t *input, uint8_t *output, int pitch);
 }
-#include "vpx/vpx_integer.h"
 
 using libvpx_test::ACMRandom;
 
diff --git a/test/dct32x32_test.cc b/test/dct32x32_test.cc
index a1e472a0aeae13b8bfc34300fcdc3a565d1fff0f..a2608acb53e250ed50830b349157e8ddf30d855b 100644
--- a/test/dct32x32_test.cc
+++ b/test/dct32x32_test.cc
@@ -18,12 +18,9 @@
 #include "test/register_state_check.h"
 #include "test/util.h"
 
-extern "C" {
 #include "./vpx_config.h"
-#include "vp9/common/vp9_entropy.h"
 #include "./vp9_rtcd.h"
-}
-
+#include "vp9/common/vp9_entropy.h"
 #include "vpx/vpx_integer.h"
 
 using libvpx_test::ACMRandom;
diff --git a/test/fdct4x4_test.cc b/test/fdct4x4_test.cc
index 67426eb74702ea15c1d326a4efb782ec2c97e563..5db5f5caeda8302f065d606144606e4133f0912a 100644
--- a/test/fdct4x4_test.cc
+++ b/test/fdct4x4_test.cc
@@ -18,12 +18,13 @@
 #include "test/register_state_check.h"
 #include "test/util.h"
 
-extern "C" {
-#include "vp9/common/vp9_entropy.h"
 #include "./vp9_rtcd.h"
+#include "vp9/common/vp9_entropy.h"
+#include "vpx/vpx_integer.h"
+
+extern "C" {
 void vp9_idct4x4_16_add_c(const int16_t *input, uint8_t *output, int pitch);
 }
-#include "vpx/vpx_integer.h"
 
 using libvpx_test::ACMRandom;
 
diff --git a/test/fdct8x8_test.cc b/test/fdct8x8_test.cc
index 19ffe26aa2a14b72f2f873d49bdf42e65d31485c..beef980557a928294bd1ed238fa349d24d130fb2 100644
--- a/test/fdct8x8_test.cc
+++ b/test/fdct8x8_test.cc
@@ -18,12 +18,13 @@
 #include "test/register_state_check.h"
 #include "test/util.h"
 
-extern "C" {
-#include "vp9/common/vp9_entropy.h"
 #include "./vp9_rtcd.h"
+#include "vp9/common/vp9_entropy.h"
+#include "vpx/vpx_integer.h"
+
+extern "C" {
 void vp9_idct8x8_64_add_c(const int16_t *input, uint8_t *output, int pitch);
 }
-#include "vpx/vpx_integer.h"
 
 using libvpx_test::ACMRandom;
 
diff --git a/test/intrapred_test.cc b/test/intrapred_test.cc
index 5fba70025081ae7f7365b184c883076e7b53047d..b28f5fbe6c6e2ab2ebacf52ca7ab4242e1d1ebcc 100644
--- a/test/intrapred_test.cc
+++ b/test/intrapred_test.cc
@@ -14,12 +14,11 @@
 #include "test/clear_system_state.h"
 #include "test/register_state_check.h"
 #include "third_party/googletest/src/include/gtest/gtest.h"
-extern "C" {
+
 #include "./vpx_config.h"
 #include "./vp8_rtcd.h"
 #include "vp8/common/blockd.h"
 #include "vpx_mem/vpx_mem.h"
-}
 
 namespace {
 
diff --git a/test/md5_helper.h b/test/md5_helper.h
index 289f6089b17d829483440ad924ca24803234d180..dd446f4f6d05f2a98f28881c0bfaed46428ae5a6 100644
--- a/test/md5_helper.h
+++ b/test/md5_helper.h
@@ -11,10 +11,8 @@
 #ifndef TEST_MD5_HELPER_H_
 #define TEST_MD5_HELPER_H_
 
-extern "C" {
 #include "./md5_utils.h"
 #include "vpx/vpx_decoder.h"
-}
 
 namespace libvpx_test {
 class MD5 {
diff --git a/test/partial_idct_test.cc b/test/partial_idct_test.cc
index a6569c0c323b14a65cd5cb7436073044b1074fd2..2a32410f3dc79ad29a7518bfa50638eea529ed75 100644
--- a/test/partial_idct_test.cc
+++ b/test/partial_idct_test.cc
@@ -18,12 +18,9 @@
 #include "test/register_state_check.h"
 #include "test/util.h"
 
-extern "C" {
 #include "./vp9_rtcd.h"
 #include "vp9/common/vp9_blockd.h"
 #include "vp9/common/vp9_scan.h"
-}
-
 #include "vpx/vpx_integer.h"
 
 using libvpx_test::ACMRandom;
diff --git a/test/set_roi.cc b/test/set_roi.cc
index 9d2e7715f292d369fb1bdecdd0d52ae153bf8a88..e28f511be6ec69e2da5132ace58ce68285216c0f 100644
--- a/test/set_roi.cc
+++ b/test/set_roi.cc
@@ -18,11 +18,9 @@
 
 #include "third_party/googletest/src/include/gtest/gtest.h"
 #include "test/acm_random.h"
+#include "vp8/encoder/onyx_int.h"
 #include "vpx/vpx_integer.h"
 #include "vpx_mem/vpx_mem.h"
-extern "C" {
-#include "vp8/encoder/onyx_int.h"
-}
 
 using libvpx_test::ACMRandom;
 
diff --git a/test/subtract_test.cc b/test/subtract_test.cc
index d1f2729720792593c7206e90e19dc399965f3cf1..3211c5c8ab436bcdef3c1f95cf36eab4e38c31dd 100644
--- a/test/subtract_test.cc
+++ b/test/subtract_test.cc
@@ -12,13 +12,11 @@
 #include "test/acm_random.h"
 #include "test/clear_system_state.h"
 #include "test/register_state_check.h"
-extern "C" {
 #include "./vpx_config.h"
 #include "./vp8_rtcd.h"
 #include "vp8/common/blockd.h"
 #include "vp8/encoder/block.h"
 #include "vpx_mem/vpx_mem.h"
-}
 
 typedef void (*subtract_b_fn_t)(BLOCK *be, BLOCKD *bd, int pitch);
 
diff --git a/test/test_libvpx.cc b/test/test_libvpx.cc
index bbcbcf9bcaca482b693a0fe20d4051a1b36bb46a..fc035af8f38e04c2ac73d6e9fffa44a1d4c9523d 100644
--- a/test/test_libvpx.cc
+++ b/test/test_libvpx.cc
@@ -9,10 +9,10 @@
  */
 #include <string>
 #include "./vpx_config.h"
-extern "C" {
 #if ARCH_X86 || ARCH_X86_64
 #include "vpx_ports/x86.h"
 #endif
+extern "C" {
 #if CONFIG_VP8
 extern void vp8_rtcd();
 #endif
diff --git a/test/variance_test.cc b/test/variance_test.cc
index 3f5560170007981143cedb19f52e1386d391526d..b9144ffabcc54ea60e3af94708e8ee8aa157e54b 100644
--- a/test/variance_test.cc
+++ b/test/variance_test.cc
@@ -17,17 +17,15 @@
 
 #include "vpx/vpx_integer.h"
 #include "./vpx_config.h"
-extern "C" {
 #include "vpx_mem/vpx_mem.h"
 #if CONFIG_VP8_ENCODER
-# include "vp8/common/variance.h"
 # include "./vp8_rtcd.h"
+# include "vp8/common/variance.h"
 #endif
 #if CONFIG_VP9_ENCODER
-# include "vp9/encoder/vp9_variance.h"
 # include "./vp9_rtcd.h"
+# include "vp9/encoder/vp9_variance.h"
 #endif
-}
 #include "test/acm_random.h"
 
 namespace {
diff --git a/test/vp8_boolcoder_test.cc b/test/vp8_boolcoder_test.cc
index 0383af20730b10082dd9055ef18d631576a960bf..fa7ee6e8c1f3ff04b600f6c47e95a2c2d1cf478b 100644
--- a/test/vp8_boolcoder_test.cc
+++ b/test/vp8_boolcoder_test.cc
@@ -20,10 +20,8 @@
 #include "third_party/googletest/src/include/gtest/gtest.h"
 #include "vpx/vpx_integer.h"
 
-extern "C" {
 #include "vp8/encoder/boolhuff.h"
 #include "vp8/decoder/dboolhuff.h"
-}
 
 namespace {
 const int num_tests = 10;
diff --git a/test/vp9_boolcoder_test.cc b/test/vp9_boolcoder_test.cc
index 1593c026738ad459b0fad32c5fbb4fcdf7775f0a..c579adeacdbe70328be7689c3fa7a0dfcbe2f287 100644
--- a/test/vp9_boolcoder_test.cc
+++ b/test/vp9_boolcoder_test.cc
@@ -14,10 +14,8 @@
 
 #include "third_party/googletest/src/include/gtest/gtest.h"
 
-extern "C" {
 #include "vp9/decoder/vp9_reader.h"
 #include "vp9/encoder/vp9_writer.h"
-}
 
 #include "test/acm_random.h"
 #include "vpx/vpx_integer.h"
diff --git a/test/vp9_subtract_test.cc b/test/vp9_subtract_test.cc
index e4c4cfeffd279d1c09424691f84d8c219e3b8601..d7df2867d0733d3a537bf00585882bf99cd02e49 100644
--- a/test/vp9_subtract_test.cc
+++ b/test/vp9_subtract_test.cc
@@ -12,12 +12,10 @@
 #include "test/acm_random.h"
 #include "test/clear_system_state.h"
 #include "test/register_state_check.h"
-extern "C" {
 #include "./vpx_config.h"
 #include "./vp9_rtcd.h"
 #include "vp9/common/vp9_blockd.h"
 #include "vpx_mem/vpx_mem.h"
-}
 
 typedef void (*subtract_fn_t)(int rows, int cols,
                               int16_t *diff_ptr, ptrdiff_t diff_stride,
diff --git a/test/y4m_video_source.h b/test/y4m_video_source.h
index bd86c2c042bec6a181540ea35cfd57f6df032e15..20d2be02b06ecd249cc807f0e96260a12edbf59c 100644
--- a/test/y4m_video_source.h
+++ b/test/y4m_video_source.h
@@ -12,9 +12,7 @@
 #include <string>
 
 #include "test/video_source.h"
-extern "C" {
 #include "./y4minput.h"
-}
 
 namespace libvpx_test {