Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(120)

Unified Diff: third_party/WebKit/Source/build/scripts/make_css_property_names.py

Issue 2780623003: Enable -Wdeprecated-register (except on CrOS and 32-bit Linux). (Closed)
Patch Set: rebase Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « build/config/compiler/BUILD.gn ('k') | third_party/WebKit/Source/build/scripts/make_css_value_keywords.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/build/scripts/make_css_property_names.py
diff --git a/third_party/WebKit/Source/build/scripts/make_css_property_names.py b/third_party/WebKit/Source/build/scripts/make_css_property_names.py
index d754ab12b9144e2b0d0ba6fdbaa2237c72126ed4..b3e05b07a39d058c7fff93bb6dfacb065522f3c4 100755
--- a/third_party/WebKit/Source/build/scripts/make_css_property_names.py
+++ b/third_party/WebKit/Source/build/scripts/make_css_property_names.py
@@ -96,6 +96,12 @@ GPERF_TEMPLATE = """
#pragma warning(disable : 4302 4311)
#endif
+#if defined(__clang__)
+#pragma clang diagnostic push
+// TODO(thakis): Remove once we use a gperf that no longer produces "register".
+#pragma clang diagnostic ignored "-Wdeprecated-register"
+#endif
+
namespace blink {
static const char propertyNameStringsPool[] = {
%(property_name_strings)s
@@ -122,55 +128,59 @@ struct Property;
%%%%
%(property_to_enum_map)s
%%%%
-const Property* findProperty(register const char* str, register unsigned int len)
-{
- return %(class_name)sHash::findPropertyImpl(str, len);
+
+#if defined(__clang__)
+#pragma clang diagnostic pop
+#endif
+
+const Property* findProperty(const char* str, unsigned int len) {
+ return %(class_name)sHash::findPropertyImpl(str, len);
}
-const char* getPropertyName(CSSPropertyID id)
-{
- DCHECK(isCSSPropertyIDWithName(id));
- int index = id - firstCSSProperty;
- return propertyNameStringsPool + propertyNameStringsOffsets[index];
+const char* getPropertyName(CSSPropertyID id) {
+ DCHECK(isCSSPropertyIDWithName(id));
+ int index = id - firstCSSProperty;
+ return propertyNameStringsPool + propertyNameStringsOffsets[index];
}
-const AtomicString& getPropertyNameAtomicString(CSSPropertyID id)
-{
- DCHECK(isCSSPropertyIDWithName(id));
- int index = id - firstCSSProperty;
- static AtomicString* propertyStrings = new AtomicString[lastUnresolvedCSSProperty]; // Intentionally never destroyed.
- AtomicString& propertyString = propertyStrings[index];
- if (propertyString.isNull())
- propertyString = AtomicString(propertyNameStringsPool + propertyNameStringsOffsets[index]);
- return propertyString;
+const AtomicString& getPropertyNameAtomicString(CSSPropertyID id) {
+ DCHECK(isCSSPropertyIDWithName(id));
+ int index = id - firstCSSProperty;
+ static AtomicString* propertyStrings =
+ new AtomicString[lastUnresolvedCSSProperty]; // Leaked.
+ AtomicString& propertyString = propertyStrings[index];
+ if (propertyString.isNull()) {
+ propertyString = AtomicString(propertyNameStringsPool +
+ propertyNameStringsOffsets[index]);
+ }
+ return propertyString;
}
-String getPropertyNameString(CSSPropertyID id)
-{
- // We share the StringImpl with the AtomicStrings.
- return getPropertyNameAtomicString(id).getString();
+String getPropertyNameString(CSSPropertyID id) {
+ // We share the StringImpl with the AtomicStrings.
+ return getPropertyNameAtomicString(id).getString();
}
-String getJSPropertyName(CSSPropertyID id)
-{
- char result[maxCSSPropertyNameLength + 1];
- const char* cssPropertyName = getPropertyName(id);
- const char* propertyNamePointer = cssPropertyName;
- if (!propertyNamePointer)
- return emptyString;
-
- char* resultPointer = result;
- while (char character = *propertyNamePointer++) {
- if (character == '-') {
- char nextCharacter = *propertyNamePointer++;
- if (!nextCharacter)
- break;
- character = (propertyNamePointer - 2 != cssPropertyName) ? toASCIIUpper(nextCharacter) : nextCharacter;
- }
- *resultPointer++ = character;
+String getJSPropertyName(CSSPropertyID id) {
+ char result[maxCSSPropertyNameLength + 1];
+ const char* cssPropertyName = getPropertyName(id);
+ const char* propertyNamePointer = cssPropertyName;
+ if (!propertyNamePointer)
+ return emptyString;
+
+ char* resultPointer = result;
+ while (char character = *propertyNamePointer++) {
+ if (character == '-') {
+ char nextCharacter = *propertyNamePointer++;
+ if (!nextCharacter)
+ break;
+ character = (propertyNamePointer - 2 != cssPropertyName)
+ ? toASCIIUpper(nextCharacter) : nextCharacter;
}
- *resultPointer = '\\0';
- return String(result);
+ *resultPointer++ = character;
+ }
+ *resultPointer = '\\0';
+ return String(result);
}
CSSPropertyID cssPropertyID(const String& string)
« no previous file with comments | « build/config/compiler/BUILD.gn ('k') | third_party/WebKit/Source/build/scripts/make_css_value_keywords.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698