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

Side by Side Diff: third_party/WebKit/Source/build/scripts/make_css_value_keywords.py

Issue 2778053003: Revert of Enable -Wdeprecated-register. (Closed)
Patch Set: 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 unified diff | Download patch
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 2
3 import os.path 3 import os.path
4 import re 4 import re
5 import subprocess 5 import subprocess
6 import sys 6 import sys
7 7
8 from name_utilities import enum_for_css_keyword 8 from name_utilities import enum_for_css_keyword
9 from name_utilities import upper_first_letter 9 from name_utilities import upper_first_letter
10 import json5_generator 10 import json5_generator
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 #include "core/css/HashTools.h" 45 #include "core/css/HashTools.h"
46 #include <string.h> 46 #include <string.h>
47 47
48 #ifdef _MSC_VER 48 #ifdef _MSC_VER
49 // Disable the warnings from casting a 64-bit pointer to 32-bit long 49 // Disable the warnings from casting a 64-bit pointer to 32-bit long
50 // warning C4302: 'type cast': truncation from 'char (*)[28]' to 'long' 50 // warning C4302: 'type cast': truncation from 'char (*)[28]' to 'long'
51 // warning C4311: 'type cast': pointer truncation from 'char (*)[18]' to 'long' 51 // warning C4311: 'type cast': pointer truncation from 'char (*)[18]' to 'long'
52 #pragma warning(disable : 4302 4311) 52 #pragma warning(disable : 4302 4311)
53 #endif 53 #endif
54 54
55 #if defined(__clang__)
56 #pragma clang diagnostic push
57 // TODO(thakis): Remove once we use a gperf that no longer produces "register".
58 #pragma clang diagnostic ignored "-Wdeprecated-register"
59 #endif
60
61 namespace blink { 55 namespace blink {
62 static const char valueListStringPool[] = { 56 static const char valueListStringPool[] = {
63 %(value_keyword_strings)s 57 %(value_keyword_strings)s
64 }; 58 };
65 59
66 static const unsigned short valueListStringOffsets[] = { 60 static const unsigned short valueListStringOffsets[] = {
67 %(value_keyword_offsets)s 61 %(value_keyword_offsets)s
68 }; 62 };
69 63
70 %%} 64 %%}
71 %%struct-type 65 %%struct-type
72 struct Value; 66 struct Value;
73 %%omit-struct-type 67 %%omit-struct-type
74 %%language=C++ 68 %%language=C++
75 %%readonly-tables 69 %%readonly-tables
76 %%compare-strncmp 70 %%compare-strncmp
77 %%define class-name %(class_name)sHash 71 %%define class-name %(class_name)sHash
78 %%define lookup-function-name findValueImpl 72 %%define lookup-function-name findValueImpl
79 %%define hash-function-name value_hash_function 73 %%define hash-function-name value_hash_function
80 %%define slot-name nameOffset 74 %%define slot-name nameOffset
81 %%define word-array-name value_word_list 75 %%define word-array-name value_word_list
82 %%pic 76 %%pic
83 %%enum 77 %%enum
84 %%%% 78 %%%%
85 %(value_keyword_to_enum_map)s 79 %(value_keyword_to_enum_map)s
86 %%%% 80 %%%%
87 81 const Value* findValue(register const char* str, register unsigned int len)
88 #if defined(__clang__) 82 {
89 #pragma clang diagnostic pop 83 return CSSValueKeywordsHash::findValueImpl(str, len);
90 #endif
91
92 const Value* findValue(const char* str, unsigned int len) {
93 return CSSValueKeywordsHash::findValueImpl(str, len);
94 } 84 }
95 85
96 const char* getValueName(CSSValueID id) { 86 const char* getValueName(CSSValueID id)
97 ASSERT(id > 0 && id < numCSSValueKeywords); 87 {
98 return valueListStringPool + valueListStringOffsets[id - 1]; 88 ASSERT(id > 0 && id < numCSSValueKeywords);
89 return valueListStringPool + valueListStringOffsets[id - 1];
99 } 90 }
100 91
101 bool isValueAllowedInMode(unsigned short id, CSSParserMode mode) { 92 bool isValueAllowedInMode(unsigned short id, CSSParserMode mode)
102 switch (id) { 93 {
103 %(ua_sheet_mode_values_keywords)s 94 switch (id) {
104 return isUASheetBehavior(mode); 95 %(ua_sheet_mode_values_keywords)s
105 %(quirks_mode_or_ua_sheet_mode_values_keywords)s 96 return isUASheetBehavior(mode);
106 return isUASheetBehavior(mode) || isQuirksModeBehavior(mode); 97 %(quirks_mode_or_ua_sheet_mode_values_keywords)s
107 default: 98 return isUASheetBehavior(mode) || isQuirksModeBehavior(mode);
108 return true; 99 default:
109 } 100 return true;
101 }
110 } 102 }
111 103
112 } // namespace blink 104 } // namespace blink
113 """ 105 """
114 106
115 107
116 class CSSValueKeywordsWriter(json5_generator.Writer): 108 class CSSValueKeywordsWriter(json5_generator.Writer):
117 class_name = "CSSValueKeywords" 109 class_name = "CSSValueKeywords"
118 110
119 def __init__(self, file_paths): 111 def __init__(self, file_paths):
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 # CalledProcessError like subprocess would do when shell=True is set. 172 # CalledProcessError like subprocess would do when shell=True is set.
181 try: 173 try:
182 gperf = subprocess.Popen(gperf_args, stdin=subprocess.PIPE, stdout=s ubprocess.PIPE, universal_newlines=True) 174 gperf = subprocess.Popen(gperf_args, stdin=subprocess.PIPE, stdout=s ubprocess.PIPE, universal_newlines=True)
183 return gperf.communicate(gperf_input)[0] 175 return gperf.communicate(gperf_input)[0]
184 except OSError: 176 except OSError:
185 raise subprocess.CalledProcessError(127, gperf_args, output='Command not found.') 177 raise subprocess.CalledProcessError(127, gperf_args, output='Command not found.')
186 178
187 179
188 if __name__ == "__main__": 180 if __name__ == "__main__":
189 json5_generator.Maker(CSSValueKeywordsWriter).main() 181 json5_generator.Maker(CSSValueKeywordsWriter).main()
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/build/scripts/make_css_property_names.py ('k') | third_party/WebKit/Source/platform/ColorData.gperf » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698