Changeset a46f7b6


Ignore:
Timestamp:
Oct 11, 2022, 1:11:43 PM (19 months ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, ast-experimental, master
Children:
a55472cc
Parents:
fd90096
Message:

Fixed some warnings/mistakes between 32/64bit builds

Files:
1 added
2 edited
1 moved

Legend:

Unmodified
Added
Removed
  • libcfa/src/concurrency/kernel/cluster.hfa

    rfd90096 ra46f7b6  
    2121
    2222#include <limits.h>
     23#include <inttypes.h>
    2324
    2425#include "clock.hfa"
     
    3031
    3132// warn normally all ints
    32 #define warn_large_before warnf( !strict || old_avg < 33_000_000_000, "Suspiciously large previous average: %'llu (%llx), %'ldms \n", old_avg, old_avg, program()`ms )
    33 #define warn_large_after warnf( !strict || ret < 33_000_000_000, "Suspiciously large new average after %'ldms cputime: %'llu (%llx) from %'llu-%'llu (%'llu, %'llu) and %'llu\n", program()`ms, ret, ret, currtsc, intsc, new_val, new_val / 1000000, old_avg )
     33#define warn_large_before warnf( !strict || old_avg < 33_000_000_000, "Suspiciously large previous average: %'llu (%llx), %'" PRId64 "ms \n", old_avg, old_avg, program()`ms )
     34#define warn_large_after warnf( !strict || ret < 33_000_000_000, "Suspiciously large new average after %'" PRId64 "ms cputime: %'llu (%llx) from %'llu-%'llu (%'llu, %'llu) and %'llu\n", program()`ms, ret, ret, currtsc, intsc, new_val, new_val / 1000000, old_avg )
    3435
    3536// 8X linear factor is just 8 * x
     
    4142static inline __readyQ_avg_t __to_readyQ_avg(unsigned long long intsc) { if(unlikely(0 == intsc)) return 0.0; else return log2(intsc); }
    4243
    43 #define warn_large_before warnf( !strict || old_avg < 35.0, "Suspiciously large previous average: %'lf, %'ldms \n", old_avg, program()`ms )
    44 #define warn_large_after warnf( !strict || ret < 35.3, "Suspiciously large new average after %'ldms cputime: %'lf from %'llu-%'llu (%'llu, %'llu) and %'lf\n", program()`ms, ret, currtsc, intsc, new_val, new_val / 1000000, old_avg ); \
     44#define warn_large_before warnf( !strict || old_avg < 35.0, "Suspiciously large previous average: %'lf, %'" PRId64 "ms \n", old_avg, program()`ms )
     45#define warn_large_after warnf( !strict || ret < 35.3, "Suspiciously large new average after %'" PRId64 "ms cputime: %'lf from %'llu-%'llu (%'llu, %'llu) and %'lf\n", program()`ms, ret, currtsc, intsc, new_val, new_val / 1000000, old_avg ); \
    4546verify(ret >= 0)
    4647
  • tests/configs/.expect/parsenums.x86.txt

    rfd90096 ra46f7b6  
    4848
    4949Usage:
    50   parsebools [OPTIONS]...
     50  parsenums [OPTIONS]...
    5151testing bool parameters
    5252  -i, --int                test int
     
    6262
    6363Usage:
    64   parsebools [OPTIONS]...
     64  parsenums [OPTIONS]...
    6565testing bool parameters
    6666  -i, --int                test int
     
    7373    WIFEXITED   : 1    WEXITSTATUS : 1    WIFSIGNALED : 0    WTERMSIG    : 0    WCOREDUMP   : 0    WIFSTOPPED  : 0    WSTOPSIG    : 1    WIFCONTINUED: 0
    7474
    75 int                :-3
    76 unsigned           :3
    77 unsigned long      :4294967296
    78 unsigned long long :3
    79 double             :3.3
     75Argument '4294967296' for option l could not be parsed
     76
     77Usage:
     78  parsenums [OPTIONS]...
     79testing bool parameters
     80  -i, --int                test int
     81  -u, --unsigned           test unsigned
     82  -l, --unsignedlong       test unsigned long
     83  -L, --unsignedlonglong   test unsigned long long
     84  -d, --double             test double
     85  -h, --help               print this help message
    8086Child status:
    81     WIFEXITED   : 1    WEXITSTATUS : 0    WIFSIGNALED : 0    WTERMSIG    : 0    WCOREDUMP   : 0    WIFSTOPPED  : 0    WSTOPSIG    : 0    WIFCONTINUED: 0
     87    WIFEXITED   : 1    WEXITSTATUS : 1    WIFSIGNALED : 0    WTERMSIG    : 0    WCOREDUMP   : 0    WIFSTOPPED  : 0    WSTOPSIG    : 1    WIFCONTINUED: 0
    8288
    8389Argument '18446744073709551616' for option L could not be parsed
    8490
    8591Usage:
    86   parsebools [OPTIONS]...
     92  parsenums [OPTIONS]...
    8793testing bool parameters
    8894  -i, --int                test int
     
    99105
    100106Usage:
    101   parsebools [OPTIONS]...
     107  parsenums [OPTIONS]...
    102108testing bool parameters
    103109  -i, --int                test int
     
    113119
    114120Usage:
    115   parsebools [OPTIONS]...
     121  parsenums [OPTIONS]...
    116122testing bool parameters
    117123  -i, --int                test int
     
    127133
    128134Usage:
    129   parsebools [OPTIONS]...
     135  parsenums [OPTIONS]...
    130136testing bool parameters
    131137  -i, --int                test int
  • tests/configs/parsenums.cfa

    rfd90096 ra46f7b6  
    1414#include <parseargs.hfa>
    1515#include <fstream.hfa>
     16
     17#if __SIZEOF_LONG__ == 4
     18        #define BIG_UNSIGNED_LONG "4294967295"
     19        #define TOO_BIG_UNSIGNED_LONG "4294967296"
     20#elif  __SIZEOF_LONG__ == 8
     21        #define BIG_UNSIGNED_LONG "18446744073709551615"
     22        #define TOO_BIG_UNSIGNED_LONG "18446744073709551616"
     23#else
     24        #error unexpected size of long
     25#endif
    1626
    1727int true_main(const char * exec);
     
    8595        printf("no arg:\n");
    8696        if(pid_t child = strict_fork(); child == 0) {
    87                 int ret = execle(path, "parsebools", (const char*)0p, env);
     97                int ret = execle(path, "parsenums", (const char*)0p, env);
    8898                if(ret < 0) {
    8999                        fprintf(stderr, "Execl 2 returned with error: %d '%s'\n", errno, strerror(errno));
     
    99109        printf("all 0 arg:\n");
    100110        if(pid_t child = strict_fork(); child == 0) {
    101                 int ret = execle(path, "parsebools", "-i=0", "-u=0", "-l=0", "-L=0", "-d=0", (const char*)0p, env);
     111                int ret = execle(path, "parsenums", "-i=0", "-u=0", "-l=0", "-L=0", "-d=0", (const char*)0p, env);
    102112                if(ret < 0) {
    103113                        fprintf(stderr, "Execl 2 returned with error: %d '%s'\n", errno, strerror(errno));
     
    113123        printf("negative vals arg:\n");
    114124        if(pid_t child = strict_fork(); child == 0) {
    115                 int ret = execle(path, "parsebools", "-i=-1", "-d=-1", (const char*)0p, env);
     125                int ret = execle(path, "parsenums", "-i=-1", "-d=-1", (const char*)0p, env);
    116126                if(ret < 0) {
    117127                        fprintf(stderr, "Execl 2 returned with error: %d '%s'\n", errno, strerror(errno));
     
    127137        printf("funky notation arg:\n");
    128138        if(pid_t child = strict_fork(); child == 0) {
    129                 int ret = execle(path, "parsebools", "-i=0x10", "-u=0x20", "-l=0x300", "-L=0x4000", "-d=5e6", (const char*)0p, env);
     139                int ret = execle(path, "parsenums", "-i=0x10", "-u=0x20", "-l=0x300", "-L=0x4000", "-d=5e6", (const char*)0p, env);
    130140                if(ret < 0) {
    131141                        fprintf(stderr, "Execl 2 returned with error: %d '%s'\n", errno, strerror(errno));
     
    141151        printf("big values arg:\n");
    142152        if(pid_t child = strict_fork(); child == 0) {
    143                 int ret = execle(path, "parsebools", "-i=2147483647", "-u=4294967295", "-l=4294967295", "-L=18446744073709551615", "-d=5e6", (const char*)0p, env);
     153                int ret = execle(path, "parsenums", "-i=2147483647", "-u=4294967295", "-l=" BIG_UNSIGNED_LONG, "-L=18446744073709551615", "-d=5e6", (const char*)0p, env);
    144154                if(ret < 0) {
    145155                        fprintf(stderr, "Execl 2 returned with error: %d '%s'\n", errno, strerror(errno));
     
    155165        printf("too big values arg:\n");
    156166        if(pid_t child = strict_fork(); child == 0) {
    157                 int ret = execle(path, "parsebools", "-i=2147483648", (const char*)0p, env);
    158                 if(ret < 0) {
    159                         fprintf(stderr, "Execl 2 returned with error: %d '%s'\n", errno, strerror(errno));
    160                         exit(1);
    161                 }
    162         }
    163         else {
    164                 int status = do_wait(child);
    165                 print_status(status);
    166         }
    167         printf("\n");
    168 
    169         if(pid_t child = strict_fork(); child == 0) {
    170                 int ret = execle(path, "parsebools", "-u=4294967296", (const char*)0p, env);
    171                 if(ret < 0) {
    172                         fprintf(stderr, "Execl 2 returned with error: %d '%s'\n", errno, strerror(errno));
    173                         exit(1);
    174                 }
    175         }
    176         else {
    177                 int status = do_wait(child);
    178                 print_status(status);
    179         }
    180         printf("\n");
    181 
    182         if(pid_t child = strict_fork(); child == 0) {
    183                 int ret = execle(path, "parsebools", "-l=4294967296", (const char*)0p, env);
    184                 if(ret < 0) {
    185                         fprintf(stderr, "Execl 2 returned with error: %d '%s'\n", errno, strerror(errno));
    186                         exit(1);
    187                 }
    188         }
    189         else {
    190                 int status = do_wait(child);
    191                 print_status(status);
    192         }
    193         printf("\n");
    194 
    195         if(pid_t child = strict_fork(); child == 0) {
    196                 int ret = execle(path, "parsebools", "-L=18446744073709551616", (const char*)0p, env);
     167                int ret = execle(path, "parsenums", "-i=2147483648", (const char*)0p, env);
     168                if(ret < 0) {
     169                        fprintf(stderr, "Execl 2 returned with error: %d '%s'\n", errno, strerror(errno));
     170                        exit(1);
     171                }
     172        }
     173        else {
     174                int status = do_wait(child);
     175                print_status(status);
     176        }
     177        printf("\n");
     178
     179        if(pid_t child = strict_fork(); child == 0) {
     180                int ret = execle(path, "parsenums", "-u=4294967296", (const char*)0p, env);
     181                if(ret < 0) {
     182                        fprintf(stderr, "Execl 2 returned with error: %d '%s'\n", errno, strerror(errno));
     183                        exit(1);
     184                }
     185        }
     186        else {
     187                int status = do_wait(child);
     188                print_status(status);
     189        }
     190        printf("\n");
     191
     192        if(pid_t child = strict_fork(); child == 0) {
     193                int ret = execle(path, "parsenums", "-l=" TOO_BIG_UNSIGNED_LONG, (const char*)0p, env);
     194                if(ret < 0) {
     195                        fprintf(stderr, "Execl 2 returned with error: %d '%s'\n", errno, strerror(errno));
     196                        exit(1);
     197                }
     198        }
     199        else {
     200                int status = do_wait(child);
     201                print_status(status);
     202        }
     203        printf("\n");
     204
     205        if(pid_t child = strict_fork(); child == 0) {
     206                int ret = execle(path, "parsenums", "-L=18446744073709551616", (const char*)0p, env);
    197207                if(ret < 0) {
    198208                        fprintf(stderr, "Execl 2 returned with error: %d '%s'\n", errno, strerror(errno));
     
    208218        printf("negative errors arg:\n");
    209219        if(pid_t child = strict_fork(); child == 0) {
    210                 int ret = execle(path, "parsebools", "-u=-1", (const char*)0p, env);
    211                 if(ret < 0) {
    212                         fprintf(stderr, "Execl 2 returned with error: %d '%s'\n", errno, strerror(errno));
    213                         exit(1);
    214                 }
    215         }
    216         else {
    217                 int status = do_wait(child);
    218                 print_status(status);
    219         }
    220         printf("\n");
    221 
    222         if(pid_t child = strict_fork(); child == 0) {
    223                 int ret = execle(path, "parsebools", "-l=-1", (const char*)0p, env);
    224                 if(ret < 0) {
    225                         fprintf(stderr, "Execl 2 returned with error: %d '%s'\n", errno, strerror(errno));
    226                         exit(1);
    227                 }
    228         }
    229         else {
    230                 int status = do_wait(child);
    231                 print_status(status);
    232         }
    233         printf("\n");
    234 
    235         if(pid_t child = strict_fork(); child == 0) {
    236                 int ret = execle(path, "parsebools", "-L=-1", (const char*)0p, env);
     220                int ret = execle(path, "parsenums", "-u=-1", (const char*)0p, env);
     221                if(ret < 0) {
     222                        fprintf(stderr, "Execl 2 returned with error: %d '%s'\n", errno, strerror(errno));
     223                        exit(1);
     224                }
     225        }
     226        else {
     227                int status = do_wait(child);
     228                print_status(status);
     229        }
     230        printf("\n");
     231
     232        if(pid_t child = strict_fork(); child == 0) {
     233                int ret = execle(path, "parsenums", "-l=-1", (const char*)0p, env);
     234                if(ret < 0) {
     235                        fprintf(stderr, "Execl 2 returned with error: %d '%s'\n", errno, strerror(errno));
     236                        exit(1);
     237                }
     238        }
     239        else {
     240                int status = do_wait(child);
     241                print_status(status);
     242        }
     243        printf("\n");
     244
     245        if(pid_t child = strict_fork(); child == 0) {
     246                int ret = execle(path, "parsenums", "-L=-1", (const char*)0p, env);
    237247                if(ret < 0) {
    238248                        fprintf(stderr, "Execl 2 returned with error: %d '%s'\n", errno, strerror(errno));
Note: See TracChangeset for help on using the changeset viewer.