diff --git a/.gitattributes b/.gitattributes
index dfc32503a6790af1a408cad7b2b04dd8f646cdf3..abb698ad099b50f035d02411b32594d4953c0dbe 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -1,6 +1,9 @@
 .gitattributes   export-ignore
 .hooks*          export-ignore
 
+# Custom attribute to mark sources as using our C code style.
+[attr]our-c-style  whitespace=tab-in-indent
+
 # Custom attribute to mark sources as generated.
 # Do not perform whitespace checks.
 [attr]generated  whitespace=-tab-in-indent,-indent-with-non-tab
@@ -20,10 +23,17 @@ configure        crlf=input
 *.sln           -crlf
 *.vcproj        -crlf
 
-*.c              whitespace=tab-in-indent
-*.h              whitespace=tab-in-indent
-*.cxx            whitespace=tab-in-indent
-*.txt            whitespace=tab-in-indent
-*.cmake          whitespace=tab-in-indent
+*.c              our-c-style
+*.cc             our-c-style
+*.cpp            our-c-style
+*.cu             our-c-style
+*.cxx            our-c-style
+*.h              our-c-style
+*.hh             our-c-style
+*.hpp            our-c-style
+*.hxx            our-c-style
+*.notcu          our-c-style
 
+*.cmake          whitespace=tab-in-indent
 *.rst            whitespace=tab-in-indent conflict-marker-size=79
+*.txt            whitespace=tab-in-indent