Skip to content

Commit 3f39d18

Browse files
committed
all: Add *FORMAT-OFF* in various places.
This string is recognised by uncrustify, to disable formatting in the region marked by these comments. This is necessary in the qstrdef*.h files to prevent modification of the strings within the Q(...). In other places it is used to prevent excessive reformatting that would make the code less readable.
1 parent b86075e commit 3f39d18

24 files changed

+43
-0
lines changed

ports/bare-arm/qstrdefsport.h

+1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
// qstrs specific to this port
2+
// *FORMAT-OFF*

ports/cc3200/qstrdefsport.h

+2
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525
* THE SOFTWARE.
2626
*/
2727

28+
// *FORMAT-OFF*
29+
2830
// for machine module
2931
Q(/)
3032
// entries for sys.path

ports/esp32/qstrdefsport.h

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
*/
2626

2727
// qstrs specific to this port, only needed if they aren't auto-generated
28+
// *FORMAT-OFF*
2829

2930
// Entries for sys.path
3031
Q(/lib)

ports/esp8266/hspi_register.h

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
* names of these defines are likely to change.
99
*/
1010

11+
// *FORMAT-OFF*
12+
1113
#ifndef SPI_REGISTER_H_INCLUDED
1214
#define SPI_REGISTER_H_INCLUDED
1315

ports/esp8266/qstrdefsport.h

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
*/
2626

2727
// qstrs specific to this port, only needed if they aren't auto-generated
28+
// *FORMAT-OFF*
2829

2930
// Entries for sys.path
3031
Q(/)

ports/javascript/qstrdefsport.h

+1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
// qstrs specific to this port
2+
// *FORMAT-OFF*

ports/minimal/qstrdefsport.h

+1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
// qstrs specific to this port
2+
// *FORMAT-OFF*

ports/nrf/qstrdefsport.h

+2
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525
*/
2626

2727
// qstrs specific to this port
28+
// *FORMAT-OFF*
29+
2830
Q(a)
2931
Q(a#)
3032
Q(a#:1)

ports/pic16bit/qstrdefsport.h

+1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
// qstrs specific to this port
2+
// *FORMAT-OFF*

ports/powerpc/qstrdefsport.h

+1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
// qstrs specific to this port
2+
// *FORMAT-OFF*

ports/qemu-arm/qstrdefsport.h

+1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
// qstrs specific to this port
2+
// *FORMAT-OFF*

ports/samd/qstrdefsport.h

+1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
// qstrs specific to this port
2+
// *FORMAT-OFF*

ports/stm32/qstrdefsport.h

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
*/
2626

2727
// qstrs specific to this port
28+
// *FORMAT-OFF*
2829

2930
// Entries for sys.path
3031
Q(/flash)

ports/teensy/qstrdefsport.h

+1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
// qstrs specific to this port
2+
// *FORMAT-OFF*

ports/unix/qstrdefsport.h

+2
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,5 @@
2323
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2424
* THE SOFTWARE.
2525
*/
26+
27+
// *FORMAT-OFF*

py/gc.c

+2
Original file line numberDiff line numberDiff line change
@@ -473,10 +473,12 @@ void *gc_alloc(size_t n_bytes, unsigned int alloc_flags) {
473473
n_free = 0;
474474
for (i = MP_STATE_MEM(gc_last_free_atb_index); i < MP_STATE_MEM(gc_alloc_table_byte_len); i++) {
475475
byte a = MP_STATE_MEM(gc_alloc_table_start)[i];
476+
// *FORMAT-OFF*
476477
if (ATB_0_IS_FREE(a)) { if (++n_free >= n_blocks) { i = i * BLOCKS_PER_ATB + 0; goto found; } } else { n_free = 0; }
477478
if (ATB_1_IS_FREE(a)) { if (++n_free >= n_blocks) { i = i * BLOCKS_PER_ATB + 1; goto found; } } else { n_free = 0; }
478479
if (ATB_2_IS_FREE(a)) { if (++n_free >= n_blocks) { i = i * BLOCKS_PER_ATB + 2; goto found; } } else { n_free = 0; }
479480
if (ATB_3_IS_FREE(a)) { if (++n_free >= n_blocks) { i = i * BLOCKS_PER_ATB + 3; goto found; } } else { n_free = 0; }
481+
// *FORMAT-ON*
480482
}
481483

482484
GC_EXIT();

py/grammar.h

+2
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
* THE SOFTWARE.
2525
*/
2626

27+
// *FORMAT-OFF*
28+
2729
// rules for writing rules:
2830
// - zero_or_more is implemented using opt_rule around a one_or_more rule
2931
// - don't put opt_rule in arguments of or rule; instead, wrap the call to this or rule in opt_rule

py/nlr.h

+4
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@
4242
#define MICROPY_NLR_NUM_REGS_XTENSA (10)
4343
#define MICROPY_NLR_NUM_REGS_XTENSAWIN (17)
4444

45+
// *FORMAT-OFF*
46+
4547
// If MICROPY_NLR_SETJMP is not enabled then auto-detect the machine arch
4648
#if !MICROPY_NLR_SETJMP
4749
// A lot of nlr-related things need different treatment on Windows
@@ -83,6 +85,8 @@
8385
#endif
8486
#endif
8587

88+
// *FORMAT-ON*
89+
8690
#if MICROPY_NLR_SETJMP
8791
#include <setjmp.h>
8892
#endif

py/objexcept.c

+4
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,8 @@ const mp_obj_type_t mp_type_BaseException = {
224224
.attr = mp_obj_exception_attr,
225225
};
226226

227+
// *FORMAT-OFF*
228+
227229
// List of all exceptions, arranged as in the table at:
228230
// http://docs.python.org/3/library/exceptions.html
229231
MP_DEFINE_EXCEPTION(SystemExit, BaseException)
@@ -303,6 +305,8 @@ MP_DEFINE_EXCEPTION(Exception, BaseException)
303305
MP_DEFINE_EXCEPTION(ResourceWarning, Warning)
304306
*/
305307

308+
// *FORMAT-ON*
309+
306310
mp_obj_t mp_obj_new_exception(const mp_obj_type_t *exc_type) {
307311
assert(exc_type->make_new == mp_obj_exception_make_new);
308312
return mp_obj_exception_make_new(exc_type, 0, 0, NULL);

py/objint_mpz.c

+2
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141

4242
#if MICROPY_PY_SYS_MAXSIZE
4343
// Export value for sys.maxsize
44+
// *FORMAT-OFF*
4445
#define DIG_MASK ((MPZ_LONG_1 << MPZ_DIG_SIZE) - 1)
4546
STATIC const mpz_dig_t maxsize_dig[] = {
4647
#define NUM_DIG 1
@@ -64,6 +65,7 @@ STATIC const mpz_dig_t maxsize_dig[] = {
6465
#endif
6566
#endif
6667
};
68+
// *FORMAT-ON*
6769
const mp_obj_int_t mp_maxsize_obj = {
6870
{&mp_type_int},
6971
{.fixed_dig = 1, .len = NUM_DIG, .alloc = NUM_DIG, .dig = (mpz_dig_t*)maxsize_dig}

py/parse.c

+4
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@
5858
// (un)comment to use rule names; for debugging
5959
//#define USE_RULE_NAME (1)
6060

61+
// *FORMAT-OFF*
62+
6163
enum {
6264
// define rules with a compile function
6365
#define DEF_RULE(rule, comp, kind, ...) RULE_##rule,
@@ -207,6 +209,8 @@ STATIC const char *const rule_name_table[] = {
207209
};
208210
#endif
209211

212+
// *FORMAT-ON*
213+
210214
typedef struct _rule_stack_t {
211215
size_t src_line : (8 * sizeof(size_t) - 8); // maximum bits storing source line number
212216
size_t rule_id : 8; // this must be large enough to fit largest rule number

py/qstrdefs.h

+2
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
* THE SOFTWARE.
2525
*/
2626

27+
// *FORMAT-OFF*
28+
2729
#include "py/mpconfig.h"
2830

2931
// All the qstr definitions in this file are available as constants.

py/vm.c

+2
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@
3636
#include "py/bc.h"
3737
#include "py/profile.h"
3838

39+
// *FORMAT-OFF*
40+
3941
#if 0
4042
#define TRACE(ip) printf("sp=%d ", (int)(sp - &code_state->state[0] + 1)); mp_bytecode_print2(ip, 1, code_state->fun_bc->const_table);
4143
#else

py/vmentrytable.h

+2
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
* THE SOFTWARE.
2525
*/
2626

27+
// *FORMAT-OFF*
28+
2729
#if __clang__
2830
#pragma clang diagnostic push
2931
#pragma clang diagnostic ignored "-Winitializer-overrides"

0 commit comments

Comments
 (0)