From a1b2319ff2ddc8a6f139ee364cabe236ca62e23e Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Mon, 8 Aug 2016 14:55:26 +0300 Subject: Add ignore case support for find_option() --- build2/cxx/compile.cxx | 5 +---- build2/cxx/link.cxx | 9 ++------- build2/cxx/msvc.cxx | 6 ++++-- 3 files changed, 7 insertions(+), 13 deletions(-) (limited to 'build2/cxx') diff --git a/build2/cxx/compile.cxx b/build2/cxx/compile.cxx index 2f1eb8d..56c518b 100644 --- a/build2/cxx/compile.cxx +++ b/build2/cxx/compile.cxx @@ -586,12 +586,9 @@ namespace build2 { // See if this one is part of the Windows drive letter. // - auto isalpha = [](char c) { - return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z');}; - if (p > 1 && p + 1 < n && // 2 chars before, 1 after. l[p - 2] == ' ' && - isalpha (l[p - 1]) && + alpha (l[p - 1]) && path::traits::is_separator (l[p + 1])) p = l.rfind (':', p - 2); } diff --git a/build2/cxx/link.cxx b/build2/cxx/link.cxx index 4ac5c43..d19d6b1 100644 --- a/build2/cxx/link.cxx +++ b/build2/cxx/link.cxx @@ -466,15 +466,10 @@ namespace build2 auto upcase_sanitize = [] (char c) -> char { - if (c >= 'a' && c <='z') - { - const unsigned char shift ('a' - 'A'); - return c - shift; - } - else if (c == '-' || c == '+' || c == '.') + if (c == '-' || c == '+' || c == '.') return '_'; else - return c; + return ucase (c); }; transform (t.name.begin (), diff --git a/build2/cxx/msvc.cxx b/build2/cxx/msvc.cxx index dcf7fee..9798046 100644 --- a/build2/cxx/msvc.cxx +++ b/build2/cxx/msvc.cxx @@ -174,10 +174,12 @@ namespace build2 if (p != string::npos && s[p + 1] == ' ') { - if (s.compare (n + 1, 3, "obj") == 0) // @@ CASE + const char* e (s.c_str () + n + 1); + + if (casecmp (e, "obj", 3) == 0) obj = true; - if (s.compare (n + 1, 3, "dll") == 0) // @@ CASE + if (casecmp (e, "dll", 3) == 0) dll = true; } } -- cgit v1.1