Index: tools/autocheck.awk
===================================================================
--- tools/autocheck.awk	(revision e3fa1720e83c1029187354ec92323608505ed7e3)
+++ tools/autocheck.awk	(revision 543662b3a5a91cc3b12c5ff897d1940f7a0248fc)
@@ -38,14 +38,16 @@
 
 /}.*;/ {
-	pattern = "}( __attribute__\\(.*\\))? " struct_name "_t;"
-	if ($0 ~ pattern) {
-		macro_name = toupper(struct_name) "_SIZE"
-		print "_Static_assert(" macro_name " == sizeof(struct " struct_name "), \"\");"
-		struct_name = ""
+	pattern = "}( __attribute__\\(.*\\))? (" struct_name "_t)?;"
+	if ($0 !~ pattern) {
+		print("Bad struct ending: " $0) > "/dev/stderr"
+		exit 1
 	}
+	macro_name = toupper(struct_name) "_SIZE"
+	print "_Static_assert(" macro_name " == sizeof(struct " struct_name "), \"\");"
+	struct_name = ""
 }
 
 /;$/ {
-	if (struct_name != "" && $0 !~ "}") {
+	if (struct_name != "") {
 		# Remove array subscript, if any.
 		sub("(\\[.*\\])?;", "", $0)
