Browse Source

fixed warning: ISO C does not permit named variadic macros

Josef Pavlik 8 years ago
parent
commit
c2b51af3ba
3 changed files with 29 additions and 29 deletions
  1. 2
    2
      Marlin/Conditionals_post.h
  2. 9
    9
      Marlin/macros.h
  3. 18
    18
      Marlin/ultralcd.cpp

+ 2
- 2
Marlin/Conditionals_post.h View File

@@ -306,13 +306,13 @@
306 306
   /**
307 307
    * ARRAY_BY_EXTRUDERS based on EXTRUDERS
308 308
    */
309
-  #define ARRAY_BY_EXTRUDERS(args...) ARRAY_N(EXTRUDERS, args)
309
+  #define ARRAY_BY_EXTRUDERS(...) ARRAY_N(EXTRUDERS, __VA_ARGS__)
310 310
   #define ARRAY_BY_EXTRUDERS1(v1) ARRAY_BY_EXTRUDERS(v1, v1, v1, v1, v1, v1)
311 311
 
312 312
   /**
313 313
    * ARRAY_BY_HOTENDS based on HOTENDS
314 314
    */
315
-  #define ARRAY_BY_HOTENDS(args...) ARRAY_N(HOTENDS, args)
315
+  #define ARRAY_BY_HOTENDS(...) ARRAY_N(HOTENDS, __VA_ARGS__)
316 316
   #define ARRAY_BY_HOTENDS1(v1) ARRAY_BY_HOTENDS(v1, v1, v1, v1, v1, v1)
317 317
 
318 318
   /**

+ 9
- 9
Marlin/macros.h View File

@@ -80,15 +80,15 @@
80 80
 #define COUNT(a) (sizeof(a)/sizeof(*a))
81 81
 
82 82
 // Macros for initializing arrays
83
-#define ARRAY_6(v1, v2, v3, v4, v5, v6, args...) { v1, v2, v3, v4, v5, v6 }
84
-#define ARRAY_5(v1, v2, v3, v4, v5, args...)     { v1, v2, v3, v4, v5 }
85
-#define ARRAY_4(v1, v2, v3, v4, args...)         { v1, v2, v3, v4 }
86
-#define ARRAY_3(v1, v2, v3, args...)             { v1, v2, v3 }
87
-#define ARRAY_2(v1, v2, args...)                 { v1, v2 }
88
-#define ARRAY_1(v1, args...)                     { v1 }
89
-
90
-#define _ARRAY_N(N, args...) ARRAY_ ##N(args)
91
-#define ARRAY_N(N, args...) _ARRAY_N(N, args)
83
+#define ARRAY_6(v1, v2, v3, v4, v5, v6, ...) { v1, v2, v3, v4, v5, v6 }
84
+#define ARRAY_5(v1, v2, v3, v4, v5, ...)     { v1, v2, v3, v4, v5 }
85
+#define ARRAY_4(v1, v2, v3, v4, ...)         { v1, v2, v3, v4 }
86
+#define ARRAY_3(v1, v2, v3, ...)             { v1, v2, v3 }
87
+#define ARRAY_2(v1, v2, ...)                 { v1, v2 }
88
+#define ARRAY_1(v1, ...)                     { v1 }
89
+
90
+#define _ARRAY_N(N, ...) ARRAY_ ##N(__VA_ARGS__)
91
+#define ARRAY_N(N, ...) _ARRAY_N(N, __VA_ARGS__)
92 92
 
93 93
 // Macros for adding
94 94
 #define INC_0 1

+ 18
- 18
Marlin/ultralcd.cpp View File

@@ -281,35 +281,35 @@ uint8_t lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW; // Set when the LCD needs to
281 281
    *     menu_action_setting_edit_int3(PSTR(MSG_SPEED), &feedrate_percentage, 10, 999)
282 282
    *
283 283
    */
284
-  #define _MENU_ITEM_PART_1(TYPE, LABEL, ARGS...) \
284
+  #define _MENU_ITEM_PART_1(TYPE, LABEL, ...) \
285 285
     if (_menuLineNr == _thisItemNr) { \
286 286
       if (lcdDrawUpdate) \
287
-        lcd_implementation_drawmenu_ ## TYPE(encoderLine == _thisItemNr, _lcdLineNr, PSTR(LABEL), ## ARGS); \
287
+        lcd_implementation_drawmenu_ ## TYPE(encoderLine == _thisItemNr, _lcdLineNr, PSTR(LABEL), ## __VA_ARGS__); \
288 288
       if (wasClicked && encoderLine == _thisItemNr) { \
289 289
         lcd_quick_feedback()
290 290
 
291
-  #define _MENU_ITEM_PART_2(TYPE, ARGS...) \
292
-        menu_action_ ## TYPE(ARGS); \
291
+  #define _MENU_ITEM_PART_2(TYPE, ...) \
292
+        menu_action_ ## TYPE(__VA_ARGS__); \
293 293
         return; \
294 294
       } \
295 295
     } \
296 296
     ++_thisItemNr
297 297
 
298
-  #define MENU_ITEM(TYPE, LABEL, ARGS...) do { \
298
+  #define MENU_ITEM(TYPE, LABEL, ...) do { \
299 299
       _skipStatic = false; \
300
-      _MENU_ITEM_PART_1(TYPE, LABEL, ## ARGS); \
301
-      _MENU_ITEM_PART_2(TYPE, ## ARGS); \
300
+      _MENU_ITEM_PART_1(TYPE, LABEL, ## __VA_ARGS__); \
301
+      _MENU_ITEM_PART_2(TYPE, ## __VA_ARGS__); \
302 302
     } while(0)
303 303
 
304 304
   // Used to print static text with no visible cursor.
305
-  #define STATIC_ITEM(LABEL, ARGS...) \
305
+  #define STATIC_ITEM(LABEL, ...) \
306 306
     if (_menuLineNr == _thisItemNr) { \
307 307
       if (_skipStatic && encoderLine <= _thisItemNr) { \
308 308
         encoderPosition += ENCODER_STEPS_PER_MENU_ITEM; \
309 309
         lcdDrawUpdate = LCDVIEW_CALL_REDRAW_NEXT; \
310 310
       } \
311 311
       if (lcdDrawUpdate) \
312
-        lcd_implementation_drawmenu_static(_lcdLineNr, PSTR(LABEL), ## ARGS); \
312
+        lcd_implementation_drawmenu_static(_lcdLineNr, PSTR(LABEL), ## __VA_ARGS__); \
313 313
     } \
314 314
     ++_thisItemNr
315 315
 
@@ -329,24 +329,24 @@ uint8_t lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW; // Set when the LCD needs to
329 329
     /**
330 330
      * MENU_MULTIPLIER_ITEM generates drawing and handling code for a multiplier menu item
331 331
      */
332
-    #define MENU_MULTIPLIER_ITEM(type, label, args...) do { \
333
-        _MENU_ITEM_PART_1(type, label, ## args); \
332
+    #define MENU_MULTIPLIER_ITEM(type, label, ...) do { \
333
+        _MENU_ITEM_PART_1(type, label, ## __VA_ARGS__); \
334 334
         encoderRateMultiplierEnabled = true; \
335 335
         lastEncoderMovementMillis = 0; \
336
-        _MENU_ITEM_PART_2(type, ## args); \
336
+        _MENU_ITEM_PART_2(type, ## __VA_ARGS__); \
337 337
       } while(0)
338 338
 
339 339
   #endif //ENCODER_RATE_MULTIPLIER
340 340
 
341 341
   #define MENU_ITEM_DUMMY() do { _thisItemNr++; } while(0)
342
-  #define MENU_ITEM_EDIT(type, label, args...) MENU_ITEM(setting_edit_ ## type, label, PSTR(label), ## args)
343
-  #define MENU_ITEM_EDIT_CALLBACK(type, label, args...) MENU_ITEM(setting_edit_callback_ ## type, label, PSTR(label), ## args)
342
+  #define MENU_ITEM_EDIT(type, label, ...) MENU_ITEM(setting_edit_ ## type, label, PSTR(label), ## __VA_ARGS__)
343
+  #define MENU_ITEM_EDIT_CALLBACK(type, label, ...) MENU_ITEM(setting_edit_callback_ ## type, label, PSTR(label), ## __VA_ARGS__)
344 344
   #if ENABLED(ENCODER_RATE_MULTIPLIER)
345
-    #define MENU_MULTIPLIER_ITEM_EDIT(type, label, args...) MENU_MULTIPLIER_ITEM(setting_edit_ ## type, label, PSTR(label), ## args)
346
-    #define MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(type, label, args...) MENU_MULTIPLIER_ITEM(setting_edit_callback_ ## type, label, PSTR(label), ## args)
345
+    #define MENU_MULTIPLIER_ITEM_EDIT(type, label, ...) MENU_MULTIPLIER_ITEM(setting_edit_ ## type, label, PSTR(label), ## __VA_ARGS__)
346
+    #define MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(type, label, ...) MENU_MULTIPLIER_ITEM(setting_edit_callback_ ## type, label, PSTR(label), ## __VA_ARGS__)
347 347
   #else //!ENCODER_RATE_MULTIPLIER
348
-    #define MENU_MULTIPLIER_ITEM_EDIT(type, label, args...) MENU_ITEM(setting_edit_ ## type, label, PSTR(label), ## args)
349
-    #define MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(type, label, args...) MENU_ITEM(setting_edit_callback_ ## type, label, PSTR(label), ## args)
348
+    #define MENU_MULTIPLIER_ITEM_EDIT(type, label, ...) MENU_ITEM(setting_edit_ ## type, label, PSTR(label), ## __VA_ARGS__)
349
+    #define MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(type, label, ...) MENU_ITEM(setting_edit_callback_ ## type, label, PSTR(label), ## __VA_ARGS__)
350 350
   #endif //!ENCODER_RATE_MULTIPLIER
351 351
 
352 352
   /** Used variables to keep track of the menu */

Loading…
Cancel
Save