Changeset c1b073b7 in mainline for kernel/generic/src/proc/thread.c


Ignore:
Timestamp:
2023-02-04T17:20:04Z (15 months ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
master, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
c030818
Parents:
30b56d9
Message:

Remove some unnecessary #ifdefs

%p does not care about specified number of digits,
so that distinction was unnecessary to begin with.
Splitting the line for 64b pointers is also more harmful
than helpful, the line is not that long.
For spacing, replaced #ifdef with regular C if.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/proc/thread.c

    r30b56d9 rc1b073b7  
    719719                name = thread->name;
    720720
    721 #ifdef __32_BITS__
    722721        if (additional)
    723                 printf("%-8" PRIu64 " %10p %10p %9" PRIu64 "%c %9" PRIu64 "%c ",
     722                printf("%-8" PRIu64 " %p %p %9" PRIu64 "%c %9" PRIu64 "%c ",
    724723                    thread->tid, thread->thread_code, thread->kstack,
    725724                    ucycles, usuffix, kcycles, ksuffix);
    726725        else
    727                 printf("%-8" PRIu64 " %-14s %10p %-8s %10p %-5" PRIu32 "\n",
     726                printf("%-8" PRIu64 " %-14s %p %-8s %p %-5" PRIu32 "\n",
    728727                    thread->tid, name, thread, thread_states[thread->state],
    729728                    thread->task, thread->task->container);
    730 #endif
    731 
    732 #ifdef __64_BITS__
    733         if (additional)
    734                 printf("%-8" PRIu64 " %18p %18p\n"
    735                     "         %9" PRIu64 "%c %9" PRIu64 "%c ",
    736                     thread->tid, thread->thread_code, thread->kstack,
    737                     ucycles, usuffix, kcycles, ksuffix);
    738         else
    739                 printf("%-8" PRIu64 " %-14s %18p %-8s %18p %-5" PRIu32 "\n",
    740                     thread->tid, name, thread, thread_states[thread->state],
    741                     thread->task, thread->task->container);
    742 #endif
    743729
    744730        if (additional) {
     
    749735
    750736                if (thread->state == Sleeping) {
    751 #ifdef __32_BITS__
    752                         printf(" %10p", thread->sleep_queue);
    753 #endif
    754 
    755 #ifdef __64_BITS__
    756                         printf(" %18p", thread->sleep_queue);
    757 #endif
     737                        printf(" %p", thread->sleep_queue);
    758738                }
    759739
     
    774754        irq_spinlock_lock(&threads_lock, true);
    775755
    776 #ifdef __32_BITS__
    777         if (additional)
    778                 printf("[id    ] [code    ] [stack   ] [ucycles ] [kcycles ]"
    779                     " [cpu] [waitqueue]\n");
    780         else
    781                 printf("[id    ] [name        ] [address ] [state ] [task    ]"
    782                     " [ctn]\n");
    783 #endif
    784 
    785 #ifdef __64_BITS__
    786         if (additional) {
    787                 printf("[id    ] [code            ] [stack           ]\n"
    788                     "         [ucycles ] [kcycles ] [cpu] [waitqueue       ]\n");
    789         } else
    790                 printf("[id    ] [name        ] [address         ] [state ]"
    791                     " [task            ] [ctn]\n");
    792 #endif
     756        if (sizeof(void *) <= 4) {
     757                if (additional)
     758                        printf("[id    ] [code    ] [stack   ] [ucycles ] [kcycles ]"
     759                            " [cpu] [waitqueue]\n");
     760                else
     761                        printf("[id    ] [name        ] [address ] [state ] [task    ]"
     762                            " [ctn]\n");
     763        } else {
     764                if (additional) {
     765                        printf("[id    ] [code            ] [stack           ] [ucycles ] [kcycles ]"
     766                            " [cpu] [waitqueue       ]\n");
     767                } else
     768                        printf("[id    ] [name        ] [address         ] [state ]"
     769                            " [task            ] [ctn]\n");
     770        }
    793771
    794772        thread = thread_first();
Note: See TracChangeset for help on using the changeset viewer.