Changeset a35b458 in mainline for kernel/test/print


Ignore:
Timestamp:
2018-03-02T20:10:49Z (8 years ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
f1380b7
Parents:
3061bc1
git-author:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-02-28 17:38:31)
git-committer:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-03-02 20:10:49)
Message:

style: Remove trailing whitespace on _all_ lines, including empty ones, for particular file types.

Command used: tools/srepl '\s\+$' '' -- *.c *.h *.py *.sh *.s *.S *.ag

Currently, whitespace on empty lines is very inconsistent.
There are two basic choices: Either remove the whitespace, or keep empty lines
indented to the level of surrounding code. The former is AFAICT more common,
and also much easier to do automatically.

Alternatively, we could write script for automatic indentation, and use that
instead. However, if such a script exists, it's possible to use the indented
style locally, by having the editor apply relevant conversions on load/save,
without affecting remote repository. IMO, it makes more sense to adopt
the simpler rule.

Location:
kernel/test/print
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • kernel/test/print/print1.c

    r3061bc1 ra35b458  
    3636        TPRINTF("Expected output: \"  tex\"\n");
    3737        TPRINTF("Real output:     \"%*.*s\"\n\n", 5, 3, "text");
    38        
     38
    3939        TPRINTF("Testing printf(\"%%10.8s\", \"very long text\"):\n");
    4040        TPRINTF("Expected output: \"  very lon\"\n");
    4141        TPRINTF("Real output:     \"%10.8s\"\n\n", "very long text");
    42        
     42
    4343        TPRINTF("Testing printf(\"%%8.10s\", \"text\"):\n");
    4444        TPRINTF("Expected output: \"    text\"\n");
    4545        TPRINTF("Real output:     \"%8.10s\"\n\n", "text");
    46        
     46
    4747        TPRINTF("Testing printf(\"%%8.10s\", \"very long text\"):\n");
    4848        TPRINTF("Expected output: \"very long \"\n");
    4949        TPRINTF("Real output:     \"%8.10s\"\n\n", "very long text");
    50        
     50
    5151        TPRINTF("Testing printf(\"%%-*.*s\", 7, 7, \"text\"):\n");
    5252        TPRINTF("Expected output: \"text   \"\n");
    5353        TPRINTF("Real output:     \"%-*.*s\"\n\n", 7, 7, "text");
    54        
     54
    5555        return NULL;
    5656}
  • kernel/test/print/print2.c

    r3061bc1 ra35b458  
    3636        TPRINTF("Expected output: [a]\n");
    3737        TPRINTF("Real output:     [%c]\n\n", 'a');
    38        
     38
    3939        TPRINTF("Testing printf(\"%%d %%3.2d %%-3.2d %%2.3d %%-2.3d\", 1, 2, 3, 4, 5):\n");
    4040        TPRINTF("Expected output: [1] [ 02] [03 ] [004] [005]\n");
    4141        TPRINTF("Real output:     [%d] [%3.2d] [%-3.2d] [%2.3d] [%-2.3d]\n\n", 1, 2, 3, 4, 5);
    42        
     42
    4343        TPRINTF("Testing printf(\"%%d %%3.2d %%-3.2d %%2.3d %%-2.3d\", -1, -2, -3, -4, -5):\n");
    4444        TPRINTF("Expected output: [-1] [-02] [-03] [-004] [-005]\n");
    4545        TPRINTF("Real output:     [%d] [%3.2d] [%-3.2d] [%2.3d] [%-2.3d]\n\n", -1, -2, -3, -4, -5);
    46        
     46
    4747        TPRINTF("Testing printf(\"%%lld %%3.2lld %%-3.2lld %%2.3lld %%-2.3lld\", (long long) -1, (long long) -2, (long long) -3, (long long) -4, (long long) -5):\n");
    4848        TPRINTF("Expected output: [-1] [-02] [-03] [-004] [-005]\n");
    4949        TPRINTF("Real output:     [%lld] [%3.2lld] [%-3.2lld] [%2.3lld] [%-2.3lld]\n\n", (long long) -1, (long long) -2, (long long) -3, (long long) -4, (long long) -5);
    50        
     50
    5151        TPRINTF("Testing printf(\"%%#x %%5.3#x %%-5.3#x %%3.5#x %%-3.5#x\", 17, 18, 19, 20, 21):\n");
    5252        TPRINTF("Expected output: [0x11] [0x012] [0x013] [0x00014] [0x00015]\n");
    5353        TPRINTF("Real output:     [%#x] [%#5.3x] [%#-5.3x] [%#3.5x] [%#-3.5x]\n\n", 17, 18, 19, 20, 21);
    54        
     54
    5555        char ch[12];
    5656        ptrdiff_t d, neg_d;
    57        
     57
    5858        d = &ch[0] - &ch[12];
    5959        neg_d = (unsigned)(-d);
     
    6161        TPRINTF("Expected output: [-12] [12] [c] [-12] [14]\n");
    6262        TPRINTF("Real output:     [%td] [%tu] [%tx] [%ti] [%to]\n\n", d, neg_d, neg_d, d, neg_d);
    63        
     63
    6464        sysarg_t nat = 0x12345678;
    65        
     65
    6666        TPRINTF("Testing printf(\"%%#" PRIx64 " %%#" PRIx32 " %%#" PRIx16 " %%#" PRIx8 " %%#" PRIxn " %%#" PRIx64 " %%s\", (uint64_t) UINT64_C(0x1234567887654321), (uint32_t) UINT32_C(0x12345678), (uint16_t) UINT16_C(0x1234), (uint8_t) UINT8_C(0x12), nat, (uint64_t) UINT64_C(0x1234567887654321), \"Lovely string\"):\n");
    6767        TPRINTF("Expected output: [0x1234567887654321] [0x12345678] [0x1234] [0x12] [0x12345678] [0x1234567887654321] \"Lovely string\"\n");
    6868        TPRINTF("Real output:     [%#" PRIx64 "] [%#" PRIx32 "] [%#" PRIx16 "] [%#" PRIx8 "] [%#" PRIxn "] [%#" PRIx64 "] \"%s\"\n\n", (uint64_t) UINT64_C(0x1234567887654321), (uint32_t) UINT32_C(0x12345678), (uint16_t) UINT16_C(0x1234), (uint8_t) UINT8_C(0x12), nat, (uint64_t) UINT64_C(0x1234567887654321), "Lovely string");
    69        
     69
    7070        return NULL;
    7171}
  • kernel/test/print/print3.c

    r3061bc1 ra35b458  
    3838        char buffer[BUFFER_SIZE];
    3939        int retval;
    40        
     40
    4141        TPRINTF("Testing snprintf(buffer, " STRING(BUFFER_SIZE) ", \"Short text without parameters.\"):\n");
    4242        TPRINTF("Expected result: retval=30 buffer=\"Short text without parameters.\"\n");
    4343        retval = snprintf(buffer, BUFFER_SIZE, "Short text without parameters.");
    4444        TPRINTF("Real result:     retval=%d buffer=\"%s\"\n\n", retval, buffer);
    45        
     45
    4646        TPRINTF("Testing snprintf(buffer, " STRING(BUFFER_SIZE) ", \"Very very very long text without parameters.\"):\n");
    4747        TPRINTF("Expected result: retval=44 buffer=\"Very very very long text withou\"\n");
    4848        retval = snprintf(buffer, BUFFER_SIZE, "Very very very long text without parameters.");
    4949        TPRINTF("Real result:     retval=%d buffer=\"%s\"\n\n", retval, buffer);
    50        
     50
    5151        TPRINTF("Testing snprintf(buffer, " STRING(BUFFER_SIZE) ", \"Short %%s.\", \"text\"):\n");
    5252        TPRINTF("Expected result: retval=11 buffer=\"Short text.\"\n");
    5353        retval = snprintf(buffer, BUFFER_SIZE, "Short %s.", "text");
    5454        TPRINTF("Real result:     retval=%d buffer=\"%s\"\n\n", retval, buffer);
    55        
     55
    5656        TPRINTF("Testing snprintf(buffer, " STRING(BUFFER_SIZE) ", \"Very long %%s. This text's length is more than %%d. We are interested in the result.\", \"text\", " STRING(BUFFER_SIZE) "):\n");
    5757        TPRINTF("Expected result: retval=84 buffer=\"Very long text. This text's len\"\n");
    5858        retval = snprintf(buffer, BUFFER_SIZE, "Very long %s. This text's length is more than %d. We are interested in the result.", "text", BUFFER_SIZE);
    5959        TPRINTF("Real result:     retval=%d buffer=\"%s\"\n\n", retval, buffer);
    60        
     60
    6161        return NULL;
    6262}
  • kernel/test/print/print4.c

    r3061bc1 ra35b458  
    3434{
    3535        TPRINTF("ASCII printable characters (32 - 127) using printf(\"%%c\") and printf(\"%%lc\"):\n");
    36        
     36
    3737        uint8_t group;
    3838        for (group = 1; group < 4; group++) {
    3939                TPRINTF("%#x: ", group << 5);
    40                
     40
    4141                uint8_t index;
    4242                for (index = 0; index < 32; index++)
    4343                        TPRINTF("%c", (char) ((group << 5) + index));
    44                
     44
    4545                TPRINTF("  ");
    4646                for (index = 0; index < 32; index++)
    4747                        TPRINTF("%lc", (wint_t) ((group << 5) + index));
    48                
     48
    4949                TPRINTF("\n");
    5050        }
    51        
     51
    5252        TPRINTF("\nExtended ASCII characters (128 - 255) using printf(\"%%lc\"):\n");
    53        
     53
    5454        for (group = 4; group < 8; group++) {
    5555                TPRINTF("%#x: ", group << 5);
    56                
     56
    5757                uint8_t index;
    5858                for (index = 0; index < 32; index++)
    5959                        TPRINTF("%lc", (wint_t) ((group << 5) + index));
    60                
     60
    6161                TPRINTF("\n");
    6262        }
    63        
     63
    6464        TPRINTF("\nUTF-8 strings using printf(\"%%s\"):\n");
    6565        TPRINTF("English:  %s\n", "Quick brown fox jumps over the lazy dog");
     
    7070        TPRINTF("Russian:  %s\n", "Леннон познакомился с художницей-авангардисткой");
    7171        TPRINTF("Armenian: %s\n", "Սկսեց հրատարակվել Երուսաղեմի հայկական");
    72        
     72
    7373        TPRINTF("\nUTF-32 strings using printf(\"%%ls\"):\n");
    7474        TPRINTF("English:  %ls\n", L"Quick brown fox jumps over the lazy dog");
     
    7979        TPRINTF("Russian:  %ls\n", L"Леннон познакомился с художницей-авангардисткой");
    8080        TPRINTF("Armenian: %ls\n", L"Սկսեց հրատարակվել Երուսաղեմի հայկական");
    81        
     81
    8282        return NULL;
    8383}
  • kernel/test/print/print5.c

    r3061bc1 ra35b458  
    4848        TPRINTF("Expected output: \"(NULL)\"\n");
    4949        TPRINTF("Real output:     \"%s\"\n\n", (char *) NULL);
    50        
     50
    5151        TPRINTF("Testing printf(\"%%c %%3.2c %%-3.2c %%2.3c %%-2.3c\", 'a', 'b', 'c', 'd', 'e'):\n");
    5252        TPRINTF("Expected output: [a] [  b] [c  ] [ d] [e ]\n");
    5353        TPRINTF("Real output:     [%c] [%3.2c] [%-3.2c] [%2.3c] [%-2.3c]\n\n", 'a', 'b', 'c', 'd', 'e');
    54        
     54
    5555        return NULL;
    5656}
Note: See TracChangeset for help on using the changeset viewer.