- The GCC variables “DEPENDENCIES_OUTPUT” and “SUNPRO_DEPENDENCIES” are now
supported correctly.
+- The algorithm that scans for `__DATE_` and `__TIME__` tokens in the hashed
+ source code now doesn't produce false positives for tokens where `__DATE__`
+ or `__TIME__` is a substring.
+
ccache 3.5.1
------------
-// Copyright (C) 2009-2018 Joel Rosdahl
+// Copyright (C) 2009-2019 Joel Rosdahl
//
// This program is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by the Free
// Check whether the substring ending at str[i] has the form "__...E__". On
// the assumption that 'E' is less common in source than '_', we check
// str[i-2] first.
- if (str[i - 2] == 'E' &&
- str[i - 0] == '_' &&
- str[i - 7] == '_' &&
- str[i - 1] == '_' &&
- str[i - 6] == '_') {
+ if (str[i - 2] == 'E'
+ && str[i - 0] == '_'
+ && str[i - 7] == '_'
+ && str[i - 1] == '_'
+ && str[i - 6] == '_'
+ && (i < 8 || (str[i - 8] != '_' && !isalnum(str[i - 8])))
+ && (i + 1 >= len || (str[i + 1] != '_' && !isalnum(str[i + 1])))) {
// Check the remaining characters to see if the substring is "__DATE__"
// or "__TIME__".
- if (str[i - 5] == 'D' && str[i - 4] == 'A' &&
- str[i - 3] == 'T') {
+ if (str[i - 5] == 'D' && str[i - 4] == 'A' && str[i - 3] == 'T') {
result |= HASH_SOURCE_CODE_FOUND_DATE;
- } else if (str[i - 5] == 'T' && str[i - 4] == 'I' &&
- str[i - 3] == 'M') {
+ } else if (str[i - 5] == 'T' && str[i - 4] == 'I' && str[i - 3] == 'M') {
result |= HASH_SOURCE_CODE_FOUND_TIME;
}
}
-// Copyright (C) 2010-2018 Joel Rosdahl
+// Copyright (C) 2010-2019 Joel Rosdahl
//
// This program is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by the Free
"#define ab __DATE__";
const char no_temporal[] =
+ "#define ab a__DATE__\n"
+ "#define ab __DATE__a\n"
+ "#define ab A__DATE__\n"
+ "#define ab __DATE__A\n"
+ "#define ab 0__DATE__\n"
+ "#define ab __DATE__0\n"
+ "#define ab _ _DATE__\n"
"#define ab _ _DATE__\n"
"#define ab __ DATE__\n"
"#define ab __D ATE__\n"