From 5b82ffc291c6b56ce85c139d48f4587d33b1f42c Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Thu, 12 Nov 2009 09:12:38 +0100 Subject: include config.h in all sources After we've been hit by Large File Support problems several times in the past week (which only occur on 32 bit platforms, which I don't have), this is yet another attempt to fix the issue. --- scripts/check_config_h.rb | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100755 scripts/check_config_h.rb (limited to 'scripts') diff --git a/scripts/check_config_h.rb b/scripts/check_config_h.rb new file mode 100755 index 00000000..2619984e --- /dev/null +++ b/scripts/check_config_h.rb @@ -0,0 +1,47 @@ +#!/usr/bin/env ruby +# +# This script verifies that every source includes config.h first. +# This is very important for consistent Large File Support. +# + +def check_file(file) + first = true + file.each_line do |line| + if line =~ /^\#include\s+(\S+)/ then + if $1 == '"config.h"' + unless first + puts "#{file.path}: config.h included too late" + end + else + if first + puts "#{file.path}: config.h missing" + end + end + first = false + end + end +end + +def check_path(path) + File.open(path) do |file| + check_file(file) + end +end + +if ARGV.empty? + Dir["src/*.c"].each do |path| + check_path(path) + end + + Dir["src/*/*.c"].each do |path| + check_path(path) + end + + Dir["test/*.c"].each do |path| + check_path(path) + end +else + ARGV.each do |path| + check_path(path) + end +end -- cgit v1.2.3