Changeset 3fe34ae for src


Ignore:
Timestamp:
Jan 12, 2017, 2:05:03 PM (7 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
7cc2c8d, 981bdc6
Parents:
0270824
Message:

Added bootloader.cf which contains the main that wraps the user main

Location:
src
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • src/SynTree/FunctionDecl.cc

    r0270824 r3fe34ae  
    2323#include "InitTweak/InitTweak.h"
    2424
     25extern bool translation_unit_nomain;
     26
    2527FunctionDecl::FunctionDecl( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec::Spec linkage, FunctionType *type, CompoundStmt *statements, bool isInline, bool isNoreturn, std::list< Attribute * > attributes )
    2628                : Parent( name, sc, linkage, attributes ), type( type ), statements( statements ) {
     
    3032        // because we want to replace the main even if it is inside an extern
    3133        if ( name == "main" ) {
    32                 set_linkage( LinkageSpec::Cforall );
     34                set_linkage( translation_unit_nomain ? LinkageSpec::C : LinkageSpec::Cforall );
    3335        } // if
    3436}
  • src/main.cc

    r0270824 r3fe34ae  
    6666        nopreludep = false,
    6767        noprotop = false,
     68        nomainp = false,
    6869        parsep = false,
    6970        resolvep = false,                                                                       // used in AlternativeFinder
     
    7980static void dump( list< Declaration * > & translationUnit, ostream & out = cout );
    8081
     82bool translation_unit_nomain = true;
    8183std::unique_ptr<FunctionDecl> translation_unit_main_signature = nullptr;
    8284
     
    157159
    158160        parse_cmdline( argc, argv, filename );                          // process command-line arguments
     161        translation_unit_nomain = nomainp;
    159162
    160163        try {
     
    375378
    376379        int c;
    377         while ( (c = getopt_long( argc, argv, "abBcefglnpqrstTvyzD:F:", long_opts, &long_index )) != -1 ) {
     380        while ( (c = getopt_long( argc, argv, "abBcefglmnpqrstTvyzD:F:", long_opts, &long_index )) != -1 ) {
    378381                switch ( c ) {
    379382                  case Ast:
     
    415418                  case 'p':                                                                             // generate prototypes for preamble functions
    416419                        noprotop = true;
     420                        break;
     421                  case 'm':                                                                             // don't replace the main
     422                        nomainp = true;
    417423                        break;
    418424                  case Parse:
  • src/prelude/Makefile.am

    r0270824 r3fe34ae  
    2020# put into lib for now
    2121cfalibdir = ${libdir}
    22 cfalib_DATA = builtins.cf extras.cf prelude.cf
     22cfalib_DATA = builtins.cf extras.cf prelude.cf bootloader.c
    2323noinst_DATA = ../libcfa/libcfa-prelude.c
    2424
     
    4545        ${AM_V_GEN}${abs_top_srcdir}/src/driver/cfa-cpp -l prelude.cf $@  # use src/cfa-cpp as not in lib until after install
    4646
     47bootloader.c : bootloader.cf extras.cf builtins.cf ${abs_top_srcdir}/src/driver/cfa-cpp
     48        ${AM_V_GEN}${abs_top_srcdir}/src/driver/cfa-cpp -tpm bootloader.cf $@  # use src/cfa-cpp as not in lib until after install
    4749
    48 MAINTAINERCLEANFILES = builtins.c builtins.cf extras.cf ${addprefix ${libdir}/,${cfalib_DATA}} ${addprefix ${libdir}/,${lib_LIBRARIES}}
     50MAINTAINERCLEANFILES = builtins.c builtins.cf extras.cf bootloader.c ${addprefix ${libdir}/,${cfalib_DATA}} ${addprefix ${libdir}/,${lib_LIBRARIES}}
  • src/prelude/Makefile.in

    r0270824 r3fe34ae  
    210210# put into lib for now
    211211cfalibdir = ${libdir}
    212 cfalib_DATA = builtins.cf extras.cf prelude.cf
     212cfalib_DATA = builtins.cf extras.cf prelude.cf bootloader.c
    213213noinst_DATA = ../libcfa/libcfa-prelude.c
    214 MAINTAINERCLEANFILES = builtins.c builtins.cf extras.cf ${addprefix ${libdir}/,${cfalib_DATA}} ${addprefix ${libdir}/,${lib_LIBRARIES}}
     214MAINTAINERCLEANFILES = builtins.c builtins.cf extras.cf bootloader.c ${addprefix ${libdir}/,${cfalib_DATA}} ${addprefix ${libdir}/,${lib_LIBRARIES}}
    215215all: all-am
    216216
     
    441441        ${AM_V_GEN}${abs_top_srcdir}/src/driver/cfa-cpp -l prelude.cf $@  # use src/cfa-cpp as not in lib until after install
    442442
     443bootloader.c : bootloader.cf extras.cf builtins.cf ${abs_top_srcdir}/src/driver/cfa-cpp
     444        ${AM_V_GEN}${abs_top_srcdir}/src/driver/cfa-cpp -tpm bootloader.cf $@  # use src/cfa-cpp as not in lib until after install
     445
    443446# Tell versions [3.59,3.63) of GNU make to not export all variables.
    444447# Otherwise a system limit (for SysV at least) may be exceeded.
Note: See TracChangeset for help on using the changeset viewer.