From 3f10ececfe08a04ecb63be2e30fc9a26533cbde0 Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Fri, 22 Jun 2012 11:47:15 -0700 Subject: [PATCH] --- yaml --- r: 311491 b: refs/heads/master c: 55f6cb9d0b364e7e8cb65b51193f5e4743c44fde h: refs/heads/master i: 311489: 0598952d77c42f7254e087adbc5eef2d28d10cb1 311487: e315e1e226d8444b6c1eb0aa875253332dc2aab8 v: v3 --- [refs] | 2 +- trunk/arch/x86/kernel/cpu/mkcapflags.pl | 23 ++++++++++++++++++----- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/[refs] b/[refs] index b59f815b338e..8f8f1c06a82c 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 4ad33411308596f2f918603509729922a1ec4411 +refs/heads/master: 55f6cb9d0b364e7e8cb65b51193f5e4743c44fde diff --git a/trunk/arch/x86/kernel/cpu/mkcapflags.pl b/trunk/arch/x86/kernel/cpu/mkcapflags.pl index dfea390e1608..0c5b54919c7b 100644 --- a/trunk/arch/x86/kernel/cpu/mkcapflags.pl +++ b/trunk/arch/x86/kernel/cpu/mkcapflags.pl @@ -11,22 +11,35 @@ print OUT "#include \n\n"; print OUT "const char * const x86_cap_flags[NCAPINTS*32] = {\n"; +%features = (); +$err = 0; + while (defined($line = )) { if ($line =~ /^\s*\#\s*define\s+(X86_FEATURE_(\S+))\s+(.*)$/) { $macro = $1; - $feature = $2; + $feature = "\L$2"; $tail = $3; if ($tail =~ /\/\*\s*\"([^"]*)\".*\*\//) { - $feature = $1; + $feature = "\L$1"; } - if ($feature ne '') { - printf OUT "\t%-32s = \"%s\",\n", - "[$macro]", "\L$feature"; + next if ($feature eq ''); + + if ($features{$feature}++) { + print STDERR "$in: duplicate feature name: $feature\n"; + $err++; } + printf OUT "\t%-32s = \"%s\",%s\n", "[$macro]", $feature; } } print OUT "};\n"; close(IN); close(OUT); + +if ($err) { + unlink($out); + exit(1); +} + +exit(0);