Skip to content

Commit 5ed3d32

Browse files
authored
Merge pull request matthijskooijman#3 from OttoWinter/clang-tidy-fixes
Fixes for clang-tidy
2 parents c41e4ff + 89bebb0 commit 5ed3d32

File tree

4 files changed

+93
-171
lines changed

4 files changed

+93
-171
lines changed

src/dsmr/fields.cpp

Lines changed: 66 additions & 132 deletions
Original file line numberDiff line numberDiff line change
@@ -54,280 +54,214 @@ constexpr char units::kvar[];
5454
constexpr char units::kvarh[];
5555

5656
constexpr ObisId identification::id;
57-
constexpr char identification::name_progmem[];
58-
constexpr const __FlashStringHelper *identification::name;
57+
constexpr char identification::name[];
5958

6059
constexpr ObisId p1_version::id;
61-
constexpr char p1_version::name_progmem[];
62-
constexpr const __FlashStringHelper *p1_version::name;
60+
constexpr char p1_version::name[];
6361

6462
/* extra field for Belgium */
6563
constexpr ObisId p1_version_be::id;
66-
constexpr char p1_version_be::name_progmem[];
67-
constexpr const __FlashStringHelper *p1_version_be::name;
64+
constexpr char p1_version_be::name[];
6865

6966
constexpr ObisId timestamp::id;
70-
constexpr char timestamp::name_progmem[];
71-
constexpr const __FlashStringHelper *timestamp::name;
67+
constexpr char timestamp::name[];
7268

7369
constexpr ObisId equipment_id::id;
74-
constexpr char equipment_id::name_progmem[];
75-
constexpr const __FlashStringHelper *equipment_id::name;
70+
constexpr char equipment_id::name[];
7671

7772
/* extra for Lux */
7873
constexpr ObisId energy_delivered_lux::id;
79-
constexpr char energy_delivered_lux::name_progmem[];
80-
constexpr const __FlashStringHelper *energy_delivered_lux::name;
74+
constexpr char energy_delivered_lux::name[];
8175

8276
constexpr ObisId energy_delivered_tariff1::id;
83-
constexpr char energy_delivered_tariff1::name_progmem[];
84-
constexpr const __FlashStringHelper *energy_delivered_tariff1::name;
77+
constexpr char energy_delivered_tariff1::name[];
8578

8679
constexpr ObisId energy_delivered_tariff2::id;
87-
constexpr char energy_delivered_tariff2::name_progmem[];
88-
constexpr const __FlashStringHelper *energy_delivered_tariff2::name;
80+
constexpr char energy_delivered_tariff2::name[];
8981

9082
/* extra for Lux */
9183
constexpr ObisId energy_returned_lux::id;
92-
constexpr char energy_returned_lux::name_progmem[];
93-
constexpr const __FlashStringHelper *energy_returned_lux::name;
84+
constexpr char energy_returned_lux::name[];
9485

9586
constexpr ObisId energy_returned_tariff1::id;
96-
constexpr char energy_returned_tariff1::name_progmem[];
97-
constexpr const __FlashStringHelper *energy_returned_tariff1::name;
87+
constexpr char energy_returned_tariff1::name[];
9888

9989
constexpr ObisId energy_returned_tariff2::id;
100-
constexpr char energy_returned_tariff2::name_progmem[];
101-
constexpr const __FlashStringHelper *energy_returned_tariff2::name;
90+
constexpr char energy_returned_tariff2::name[];
10291

10392
/* extra for Lux */
10493
constexpr ObisId total_imported_energy::id;
105-
constexpr char total_imported_energy::name_progmem[];
106-
constexpr const __FlashStringHelper *total_imported_energy::name;
94+
constexpr char total_imported_energy::name[];
10795

10896
/* extra for Lux */
10997
constexpr ObisId total_exported_energy::id;
110-
constexpr char total_exported_energy::name_progmem[];
111-
constexpr const __FlashStringHelper *total_exported_energy::name;
98+
constexpr char total_exported_energy::name[];
11299

113100
/* extra for Lux */
114101
constexpr ObisId reactive_power_delivered::id;
115-
constexpr char reactive_power_delivered::name_progmem[];
116-
constexpr const __FlashStringHelper *reactive_power_delivered::name;
102+
constexpr char reactive_power_delivered::name[];
117103

118104
/* extra for Lux */
119105
constexpr ObisId reactive_power_returned::id;
120-
constexpr char reactive_power_returned::name_progmem[];
121-
constexpr const __FlashStringHelper *reactive_power_returned::name;
106+
constexpr char reactive_power_returned::name[];
122107

123108
constexpr ObisId electricity_tariff::id;
124-
constexpr char electricity_tariff::name_progmem[];
125-
constexpr const __FlashStringHelper *electricity_tariff::name;
109+
constexpr char electricity_tariff::name[];
126110

127111
constexpr ObisId power_delivered::id;
128-
constexpr char power_delivered::name_progmem[];
129-
constexpr const __FlashStringHelper *power_delivered::name;
112+
constexpr char power_delivered::name[];
130113

131114
constexpr ObisId power_returned::id;
132-
constexpr char power_returned::name_progmem[];
133-
constexpr const __FlashStringHelper *power_returned::name;
115+
constexpr char power_returned::name[];
134116

135117
constexpr ObisId electricity_threshold::id;
136-
constexpr char electricity_threshold::name_progmem[];
137-
constexpr const __FlashStringHelper *electricity_threshold::name;
118+
constexpr char electricity_threshold::name[];
138119

139120
constexpr ObisId electricity_switch_position::id;
140-
constexpr char electricity_switch_position::name_progmem[];
141-
constexpr const __FlashStringHelper *electricity_switch_position::name;
121+
constexpr char electricity_switch_position::name[];
142122

143123
constexpr ObisId electricity_failures::id;
144-
constexpr char electricity_failures::name_progmem[];
145-
constexpr const __FlashStringHelper *electricity_failures::name;
124+
constexpr char electricity_failures::name[];
146125

147126
constexpr ObisId electricity_long_failures::id;
148-
constexpr char electricity_long_failures::name_progmem[];
149-
constexpr const __FlashStringHelper *electricity_long_failures::name;
127+
constexpr char electricity_long_failures::name[];
150128

151129
constexpr ObisId electricity_failure_log::id;
152-
constexpr char electricity_failure_log::name_progmem[];
153-
constexpr const __FlashStringHelper *electricity_failure_log::name;
130+
constexpr char electricity_failure_log::name[];
154131

155132
constexpr ObisId electricity_sags_l1::id;
156-
constexpr char electricity_sags_l1::name_progmem[];
157-
constexpr const __FlashStringHelper *electricity_sags_l1::name;
133+
constexpr char electricity_sags_l1::name[];
158134

159135
constexpr ObisId electricity_sags_l2::id;
160-
constexpr char electricity_sags_l2::name_progmem[];
161-
constexpr const __FlashStringHelper *electricity_sags_l2::name;
136+
constexpr char electricity_sags_l2::name[];
162137

163138
constexpr ObisId electricity_sags_l3::id;
164-
constexpr char electricity_sags_l3::name_progmem[];
165-
constexpr const __FlashStringHelper *electricity_sags_l3::name;
139+
constexpr char electricity_sags_l3::name[];
166140

167141
constexpr ObisId electricity_swells_l1::id;
168-
constexpr char electricity_swells_l1::name_progmem[];
169-
constexpr const __FlashStringHelper *electricity_swells_l1::name;
142+
constexpr char electricity_swells_l1::name[];
170143

171144
constexpr ObisId electricity_swells_l2::id;
172-
constexpr char electricity_swells_l2::name_progmem[];
173-
constexpr const __FlashStringHelper *electricity_swells_l2::name;
145+
constexpr char electricity_swells_l2::name[];
174146

175147
constexpr ObisId electricity_swells_l3::id;
176-
constexpr char electricity_swells_l3::name_progmem[];
177-
constexpr const __FlashStringHelper *electricity_swells_l3::name;
148+
constexpr char electricity_swells_l3::name[];
178149

179150
constexpr ObisId message_short::id;
180-
constexpr char message_short::name_progmem[];
181-
constexpr const __FlashStringHelper *message_short::name;
151+
constexpr char message_short::name[];
182152

183153
constexpr ObisId message_long::id;
184-
constexpr char message_long::name_progmem[];
185-
constexpr const __FlashStringHelper *message_long::name;
154+
constexpr char message_long::name[];
186155

187156
constexpr ObisId voltage_l1::id;
188-
constexpr char voltage_l1::name_progmem[];
189-
constexpr const __FlashStringHelper *voltage_l1::name;
157+
constexpr char voltage_l1::name[];
190158

191159
constexpr ObisId voltage_l2::id;
192-
constexpr char voltage_l2::name_progmem[];
193-
constexpr const __FlashStringHelper *voltage_l2::name;
160+
constexpr char voltage_l2::name[];
194161

195162
constexpr ObisId voltage_l3::id;
196-
constexpr char voltage_l3::name_progmem[];
197-
constexpr const __FlashStringHelper *voltage_l3::name;
163+
constexpr char voltage_l3::name[];
198164

199165
constexpr ObisId current_l1::id;
200-
constexpr char current_l1::name_progmem[];
201-
constexpr const __FlashStringHelper *current_l1::name;
166+
constexpr char current_l1::name[];
202167

203168
constexpr ObisId current_l2::id;
204-
constexpr char current_l2::name_progmem[];
205-
constexpr const __FlashStringHelper *current_l2::name;
169+
constexpr char current_l2::name[];
206170

207171
constexpr ObisId current_l3::id;
208-
constexpr char current_l3::name_progmem[];
209-
constexpr const __FlashStringHelper *current_l3::name;
172+
constexpr char current_l3::name[];
210173

211174
constexpr ObisId power_delivered_l1::id;
212-
constexpr char power_delivered_l1::name_progmem[];
213-
constexpr const __FlashStringHelper *power_delivered_l1::name;
175+
constexpr char power_delivered_l1::name[];
214176

215177
constexpr ObisId power_delivered_l2::id;
216-
constexpr char power_delivered_l2::name_progmem[];
217-
constexpr const __FlashStringHelper *power_delivered_l2::name;
178+
constexpr char power_delivered_l2::name[];
218179

219180
constexpr ObisId power_delivered_l3::id;
220-
constexpr char power_delivered_l3::name_progmem[];
221-
constexpr const __FlashStringHelper *power_delivered_l3::name;
181+
constexpr char power_delivered_l3::name[];
222182

223183
constexpr ObisId power_returned_l1::id;
224-
constexpr char power_returned_l1::name_progmem[];
225-
constexpr const __FlashStringHelper *power_returned_l1::name;
184+
constexpr char power_returned_l1::name[];
226185

227186
constexpr ObisId power_returned_l2::id;
228-
constexpr char power_returned_l2::name_progmem[];
229-
constexpr const __FlashStringHelper *power_returned_l2::name;
187+
constexpr char power_returned_l2::name[];
230188

231189
constexpr ObisId power_returned_l3::id;
232-
constexpr char power_returned_l3::name_progmem[];
233-
constexpr const __FlashStringHelper *power_returned_l3::name;
190+
constexpr char power_returned_l3::name[];
234191

235192
/* LUX */
236193
constexpr ObisId reactive_power_delivered_l1::id;
237-
constexpr char reactive_power_delivered_l1::name_progmem[];
238-
constexpr const __FlashStringHelper *reactive_power_delivered_l1::name;
194+
constexpr char reactive_power_delivered_l1::name[];
239195

240196
/* LUX */
241197
constexpr ObisId reactive_power_delivered_l2::id;
242-
constexpr char reactive_power_delivered_l2::name_progmem[];
243-
constexpr const __FlashStringHelper *reactive_power_delivered_l2::name;
198+
constexpr char reactive_power_delivered_l2::name[];
244199

245200
/* LUX */
246201
constexpr ObisId reactive_power_delivered_l3::id;
247-
constexpr char reactive_power_delivered_l3::name_progmem[];
248-
constexpr const __FlashStringHelper *reactive_power_delivered_l3::name;
202+
constexpr char reactive_power_delivered_l3::name[];
249203

250204
/* LUX */
251205
constexpr ObisId reactive_power_returned_l1::id;
252-
constexpr char reactive_power_returned_l1::name_progmem[];
253-
constexpr const __FlashStringHelper *reactive_power_returned_l1::name;
206+
constexpr char reactive_power_returned_l1::name[];
254207

255208
/* LUX */
256209
constexpr ObisId reactive_power_returned_l2::id;
257-
constexpr char reactive_power_returned_l2::name_progmem[];
258-
constexpr const __FlashStringHelper *reactive_power_returned_l2::name;
210+
constexpr char reactive_power_returned_l2::name[];
259211

260212
/* LUX */
261213
constexpr ObisId reactive_power_returned_l3::id;
262-
constexpr char reactive_power_returned_l3::name_progmem[];
263-
constexpr const __FlashStringHelper *reactive_power_returned_l3::name;
214+
constexpr char reactive_power_returned_l3::name[];
264215

265216
constexpr ObisId gas_device_type::id;
266-
constexpr char gas_device_type::name_progmem[];
267-
constexpr const __FlashStringHelper *gas_device_type::name;
217+
constexpr char gas_device_type::name[];
268218

269219
constexpr ObisId gas_equipment_id::id;
270-
constexpr char gas_equipment_id::name_progmem[];
271-
constexpr const __FlashStringHelper *gas_equipment_id::name;
220+
constexpr char gas_equipment_id::name[];
272221

273222
constexpr ObisId gas_valve_position::id;
274-
constexpr char gas_valve_position::name_progmem[];
275-
constexpr const __FlashStringHelper *gas_valve_position::name;
223+
constexpr char gas_valve_position::name[];
276224

277225
/* _NL */
278226
constexpr ObisId gas_delivered::id;
279-
constexpr char gas_delivered::name_progmem[];
280-
constexpr const __FlashStringHelper *gas_delivered::name;
227+
constexpr char gas_delivered::name[];
281228

282229
/* _BE */
283230
constexpr ObisId gas_delivered_be::id;
284-
constexpr char gas_delivered_be::name_progmem[];
285-
constexpr const __FlashStringHelper *gas_delivered_be::name;
231+
constexpr char gas_delivered_be::name[];
286232

287233
constexpr ObisId thermal_device_type::id;
288-
constexpr char thermal_device_type::name_progmem[];
289-
constexpr const __FlashStringHelper *thermal_device_type::name;
234+
constexpr char thermal_device_type::name[];
290235

291236
constexpr ObisId thermal_equipment_id::id;
292-
constexpr char thermal_equipment_id::name_progmem[];
293-
constexpr const __FlashStringHelper *thermal_equipment_id::name;
237+
constexpr char thermal_equipment_id::name[];
294238

295239
constexpr ObisId thermal_valve_position::id;
296-
constexpr char thermal_valve_position::name_progmem[];
297-
constexpr const __FlashStringHelper *thermal_valve_position::name;
240+
constexpr char thermal_valve_position::name[];
298241

299242
constexpr ObisId thermal_delivered::id;
300-
constexpr char thermal_delivered::name_progmem[];
301-
constexpr const __FlashStringHelper *thermal_delivered::name;
243+
constexpr char thermal_delivered::name[];
302244

303245
constexpr ObisId water_device_type::id;
304-
constexpr char water_device_type::name_progmem[];
305-
constexpr const __FlashStringHelper *water_device_type::name;
246+
constexpr char water_device_type::name[];
306247

307248
constexpr ObisId water_equipment_id::id;
308-
constexpr char water_equipment_id::name_progmem[];
309-
constexpr const __FlashStringHelper *water_equipment_id::name;
249+
constexpr char water_equipment_id::name[];
310250

311251
constexpr ObisId water_valve_position::id;
312-
constexpr char water_valve_position::name_progmem[];
313-
constexpr const __FlashStringHelper *water_valve_position::name;
252+
constexpr char water_valve_position::name[];
314253

315254
constexpr ObisId water_delivered::id;
316-
constexpr char water_delivered::name_progmem[];
317-
constexpr const __FlashStringHelper *water_delivered::name;
255+
constexpr char water_delivered::name[];
318256

319257
constexpr ObisId sub_device_type::id;
320-
constexpr char sub_device_type::name_progmem[];
321-
constexpr const __FlashStringHelper *sub_device_type::name;
258+
constexpr char sub_device_type::name[];
322259

323260
constexpr ObisId sub_equipment_id::id;
324-
constexpr char sub_equipment_id::name_progmem[];
325-
constexpr const __FlashStringHelper *sub_equipment_id::name;
261+
constexpr char sub_equipment_id::name[];
326262

327263
constexpr ObisId sub_valve_position::id;
328-
constexpr char sub_valve_position::name_progmem[];
329-
constexpr const __FlashStringHelper *sub_valve_position::name;
264+
constexpr char sub_valve_position::name[];
330265

331266
constexpr ObisId sub_delivered::id;
332-
constexpr char sub_delivered::name_progmem[];
333-
constexpr const __FlashStringHelper *sub_delivered::name;
267+
constexpr char sub_delivered::name[];

src/dsmr/fields.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,8 +199,7 @@ namespace dsmr
199199
value_t fieldname; \
200200
bool fieldname##_present = false; \
201201
static constexpr ObisId id = obis; \
202-
static constexpr char name_progmem[] DSMR_PROGMEM = #fieldname; \
203-
static constexpr const __FlashStringHelper *name = reinterpret_cast<const __FlashStringHelper *>(&name_progmem); \
202+
static constexpr char name[] = #fieldname; \
204203
value_t &val() { return fieldname; } \
205204
bool &present() { return fieldname##_present; } \
206205
}

0 commit comments

Comments
 (0)