Changeset 433d352


Ignore:
Timestamp:
Sep 24, 2020, 4:12:15 PM (13 months ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
arm-eh, jacob/cs343-translation, master, new-ast-unique-expr
Children:
58d64a4
Parents:
eccb14d
Message:

Parse args now uses weak globals to allow linking with C.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/parseargs.cfa

    reccb14d r433d352  
    2525#include "limits.hfa"
    2626
    27 extern int cfa_args_argc;
    28 extern char ** cfa_args_argv;
    29 extern char ** cfa_args_envp;
     27extern int cfa_args_argc __attribute__((weak));
     28extern char ** cfa_args_argv __attribute__((weak));
     29extern char ** cfa_args_envp __attribute__((weak));
    3030
    3131static void usage(char * cmd, cfa_option options[], size_t opt_count, const char * usage, FILE * out)  __attribute__ ((noreturn));
    3232
    3333void parse_args( cfa_option options[], size_t opt_count, const char * usage, char ** & left ) {
    34         parse_args(cfa_args_argc, cfa_args_argv, options, opt_count, usage, left );
     34        if( 0p != &cfa_args_argc ) {
     35                parse_args(cfa_args_argc, cfa_args_argv, options, opt_count, usage, left );
     36        }
     37        else {
     38                char * temp = "";
     39                parse_args(0, &temp, options, opt_count, usage, left );
     40        }
    3541}
    3642
Note: See TracChangeset for help on using the changeset viewer.