view @ 1109:97d80437cb80

Fix field access from inline asm. See tests/mini/asm10.d
author Frits van Bommel <fvbommel>
date Thu, 12 Mar 2009 23:48:43 +0100
parents dc576c7e4b1e
children 829ac3f30103
line wrap: on
line source


use strict;
use warnings;
use File::stat;
use Time::localtime;

my $llvm_src = `perl @LLVM_CONFIG@ --src-root`;

my $llvm_rev = `svnversion --committed $llvm_src`;
my $llvm_rev_str;
my $llvm_rev_nr;

if ($llvm_rev =~ /^\s*(\d+:)?((\d+)[MSP]*)\s*$/) {
	$llvm_rev_str = qq!#define LLVM_REV_STR "LLVM rev. $2"!;
	$llvm_rev_nr = "$3";
} else {
	my $llvm_lib = `perl @LLVM_CONFIG@ --libdir`;
	$llvm_lib =~ s/\s+$//;
	$llvm_rev = ctime(stat($llvm_lib)->mtime) if (-d $llvm_lib);
	$llvm_rev_str = qq!#include "llvm/Config/config.h"\n#define LLVM_REV_STR PACKAGE_STRING" ($llvm_rev)"!;
	# Assume latest release, so < any version we should be testing for.
	$llvm_rev_nr = 0;

my $ldc_rev = `hg -R@PROJECT_SOURCE_DIR@ log -r qparent --template '{rev}:{node|short} ({date|isodate})' 2>/dev/null || hg -R@PROJECT_SOURCE_DIR@ tip --template '{rev}:{node|short} ({date|isodate})'`;

my $out = qq!#ifndef LDC_VERSIONS_H

// LLVM version string, for use in -version output
// LLVM svn revision number, used to adapt to changes in LLVM
// (Is 0 if LLVM is not an SVN version)
#define LLVM_REV $llvm_rev_nr
// LDC version string, for use in -version output
#define LDC_REV "rev. $ldc_rev"

#endif // LDC_VERSIONS_H\n!;

my $revh;
my $old = "";
open $revh, "revisions.h" and $old = join "", <$revh>;

if ($old ne $out) {
	open $revh, ">revisions.h" or die "cannot create revisions.h: $!";
	print $revh $out;
	close $revh;