From 796fe95bf2a448ef3252ba4314f09382cd4c033c Mon Sep 17 00:00:00 2001 From: Bensong Liu <bensl@microsoft.com> Date: Tue, 28 Jul 2020 14:12:31 +0800 Subject: [PATCH] upgrade rlib --- src/lib/rlib/Makefile | 2 +- src/lib/rlib/buildspec.yaml | 2 +- src/lib/rlib/opt.hpp | 30 ++--- src/lib/rlib/sys/cc_list | 16 +-- src/lib/rlib/sys/compiler_detector | 185 ++++++++++++++--------------- 5 files changed, 115 insertions(+), 120 deletions(-) diff --git a/src/lib/rlib/Makefile b/src/lib/rlib/Makefile index 1587264..e7e2e1d 100644 --- a/src/lib/rlib/Makefile +++ b/src/lib/rlib/Makefile @@ -8,7 +8,7 @@ ARFLAGS = rcs PREFIX ?= /usr def: - @echo Run make install + @echo This library is header-only, and no need to compile. Run make install if you would like. install_header: [ ! -d $(PREFIX)/include/rlib ] || rm -rf $(PREFIX)/include/rlib diff --git a/src/lib/rlib/buildspec.yaml b/src/lib/rlib/buildspec.yaml index a138100..415610b 100644 --- a/src/lib/rlib/buildspec.yaml +++ b/src/lib/rlib/buildspec.yaml @@ -9,7 +9,7 @@ phases: commands: - g++ --version - clang++ --version - - icpc --version + # - icpc --version # Intel CC on build machine expired... build: commands: - make diff --git a/src/lib/rlib/opt.hpp b/src/lib/rlib/opt.hpp index 3654fdf..c0d9224 100644 --- a/src/lib/rlib/opt.hpp +++ b/src/lib/rlib/opt.hpp @@ -78,20 +78,6 @@ namespace rlib { return *pos; } } - - rlib::string getValueArg(const std::string &longName, const char *shortName) - { //getValueArg("--long", "-l") may be converted to getValueArg("--long", true). - return getValueArg(longName, shortName, true); - } - - bool getBoolArg(const std::string &argName) - { //Return if it's defined. - auto pos = std::find(args.cbegin(), args.cend(), argName); - if(pos == args.cend()) return false; - args.erase(pos); - return true; - } - rlib::string getValueArg(const std::string &longName, const std::string &shortName, bool required = true, const std::string &def = std::string()) { using rlib::literals::operator "" _format; @@ -108,6 +94,22 @@ namespace rlib { return std::move(value); } + rlib::string getValueArg(const std::string &longName, const char *shortName) + { //getValueArg("--long", "-l") may be converted to getValueArg("--long", true). + return getValueArg(longName, std::string(shortName)); + } + rlib::string getValueArg(const std::string& argName, bool required, const char * def) { + return getValueArg(argName, required, std::string(def)); + } + + bool getBoolArg(const std::string &argName) + { //Return if it's defined. + auto pos = std::find(args.cbegin(), args.cend(), argName); + if(pos == args.cend()) return false; + args.erase(pos); + return true; + } + bool getBoolArg(const std::string &longName, const std::string &shortName) { return getBoolArg(longName) || getBoolArg(shortName); diff --git a/src/lib/rlib/sys/cc_list b/src/lib/rlib/sys/cc_list index 92d6817..ef92adc 100644 --- a/src/lib/rlib/sys/cc_list +++ b/src/lib/rlib/sys/cc_list @@ -1,3 +1,11 @@ +__clang__ CLANG +__ICC __INTEL_COMPILER ICC +# ICC must be placed before GCC +__GNUC__ GCC +__llvm__ LLVM +_MSC_VER MSVC +SDCC SDCC + _ACC_ ACC __CMB__ ALTIUM_MICROBLAZE __CHC__ ALTIUM_HARDWARE @@ -6,7 +14,6 @@ __CC_ARM ARMCC AZTEC_C __AZTEC_C__ AZTEC __BORLANDC__ __CODEGEARC__ BORLAND __CC65__ CC65 -__clang__ CLANG __COMO__ COMEAU __DECC __DECCXX COMPAQ __convexc__ CONVEX @@ -18,12 +25,8 @@ _DICE DICE __DMC__ DIGITAL_MARS __SYSC__ DIGNUS __DJGPP__ DJGPP -__ICC __INTEL_COMPILER ICC -# ICC must be placed before: EDG, GCC -__EDG__ EDG __PATHCC__ EKOPATH __FCC_VERSION FUJITSU -__GNUC__ GCC __ghs__ GREENHILL __HP_cc HPC __HP_aCC HPACXX @@ -35,9 +38,7 @@ __CA__ __KEIL__ KEIL_CARM __C166__ KEIL_C166 __C51__ __CX51__ KEIL_C51 __LCC__ LCC -__llvm__ LLVM __MWERKS__ __CWCC__ METROWERKS -_MSC_VER MSVC _MRI MICROTEC __NDPC__ __NDPX__ MICROWAY __sgi sgi MIPSPRO @@ -55,7 +56,6 @@ __PGI PORTLAND __RENESAS__ __HITACHI__ RENESAS SASC __SASC __SASC__ SASC _SCO_DS SCO_OPENSERVER -SDCC SDCC __SNC__ SN __VOSC__ STRATUS_VOS __SC__ SYMANTEC diff --git a/src/lib/rlib/sys/compiler_detector b/src/lib/rlib/sys/compiler_detector index 99f6dcf..7b0be54 100644 --- a/src/lib/rlib/sys/compiler_detector +++ b/src/lib/rlib/sys/compiler_detector @@ -1,276 +1,276 @@ // Generated by cc_codegen.py. Do not edit it by hand. +#ifndef RLIB_COMPILER_ID +#if defined(__clang__) +#define RLIB_COMPILER_ID CC_CLANG +#endif +#endif +#define CC_CLANG 90714 + +#ifndef RLIB_COMPILER_ID +#if defined(__ICC) || defined(__INTEL_COMPILER) +#define RLIB_COMPILER_ID CC_ICC +#endif +#endif +#define CC_ICC 90715 + +#ifndef RLIB_COMPILER_ID +#if defined(__GNUC__) +#define RLIB_COMPILER_ID CC_GCC +#endif +#endif +#define CC_GCC 90716 + +#ifndef RLIB_COMPILER_ID +#if defined(__llvm__) +#define RLIB_COMPILER_ID CC_LLVM +#endif +#endif +#define CC_LLVM 90717 + +#ifndef RLIB_COMPILER_ID +#if defined(_MSC_VER) +#define RLIB_COMPILER_ID CC_MSVC +#endif +#endif +#define CC_MSVC 90718 + +#ifndef RLIB_COMPILER_ID +#if defined(SDCC) +#define RLIB_COMPILER_ID CC_SDCC +#endif +#endif +#define CC_SDCC 90719 + #ifndef RLIB_COMPILER_ID #if defined(_ACC_) #define RLIB_COMPILER_ID CC_ACC #endif #endif -#define CC_ACC 90714 +#define CC_ACC 90720 #ifndef RLIB_COMPILER_ID #if defined(__CMB__) #define RLIB_COMPILER_ID CC_ALTIUM_MICROBLAZE #endif #endif -#define CC_ALTIUM_MICROBLAZE 90715 +#define CC_ALTIUM_MICROBLAZE 90721 #ifndef RLIB_COMPILER_ID #if defined(__CHC__) #define RLIB_COMPILER_ID CC_ALTIUM_HARDWARE #endif #endif -#define CC_ALTIUM_HARDWARE 90716 +#define CC_ALTIUM_HARDWARE 90722 #ifndef RLIB_COMPILER_ID #if defined(__ACK__) #define RLIB_COMPILER_ID CC_AMSTERDAM #endif #endif -#define CC_AMSTERDAM 90717 +#define CC_AMSTERDAM 90723 #ifndef RLIB_COMPILER_ID #if defined(__CC_ARM) #define RLIB_COMPILER_ID CC_ARMCC #endif #endif -#define CC_ARMCC 90718 +#define CC_ARMCC 90724 #ifndef RLIB_COMPILER_ID #if defined(AZTEC_C) || defined(__AZTEC_C__) #define RLIB_COMPILER_ID CC_AZTEC #endif #endif -#define CC_AZTEC 90719 +#define CC_AZTEC 90725 #ifndef RLIB_COMPILER_ID #if defined(__BORLANDC__) || defined(__CODEGEARC__) #define RLIB_COMPILER_ID CC_BORLAND #endif #endif -#define CC_BORLAND 90720 +#define CC_BORLAND 90726 #ifndef RLIB_COMPILER_ID #if defined(__CC65__) #define RLIB_COMPILER_ID CC_CC65 #endif #endif -#define CC_CC65 90721 - -#ifndef RLIB_COMPILER_ID -#if defined(__clang__) -#define RLIB_COMPILER_ID CC_CLANG -#endif -#endif -#define CC_CLANG 90722 +#define CC_CC65 90727 #ifndef RLIB_COMPILER_ID #if defined(__COMO__) #define RLIB_COMPILER_ID CC_COMEAU #endif #endif -#define CC_COMEAU 90723 +#define CC_COMEAU 90728 #ifndef RLIB_COMPILER_ID #if defined(__DECC) || defined(__DECCXX) #define RLIB_COMPILER_ID CC_COMPAQ #endif #endif -#define CC_COMPAQ 90724 +#define CC_COMPAQ 90729 #ifndef RLIB_COMPILER_ID #if defined(__convexc__) #define RLIB_COMPILER_ID CC_CONVEX #endif #endif -#define CC_CONVEX 90725 +#define CC_CONVEX 90730 #ifndef RLIB_COMPILER_ID #if defined(__COMPCERT__) #define RLIB_COMPILER_ID CC_COMPCERT #endif #endif -#define CC_COMPCERT 90726 +#define CC_COMPCERT 90731 #ifndef RLIB_COMPILER_ID #if defined(__COVERITY__) #define RLIB_COMPILER_ID CC_COVERITY #endif #endif -#define CC_COVERITY 90727 +#define CC_COVERITY 90732 #ifndef RLIB_COMPILER_ID #if defined(_CRAYC) #define RLIB_COMPILER_ID CC_CRAY #endif #endif -#define CC_CRAY 90728 +#define CC_CRAY 90733 #ifndef RLIB_COMPILER_ID #if defined(__DCC__) #define RLIB_COMPILER_ID CC_DIAB #endif #endif -#define CC_DIAB 90729 +#define CC_DIAB 90734 #ifndef RLIB_COMPILER_ID #if defined(_DICE) #define RLIB_COMPILER_ID CC_DICE #endif #endif -#define CC_DICE 90730 +#define CC_DICE 90735 #ifndef RLIB_COMPILER_ID #if defined(__DMC__) #define RLIB_COMPILER_ID CC_DIGITAL_MARS #endif #endif -#define CC_DIGITAL_MARS 90731 +#define CC_DIGITAL_MARS 90736 #ifndef RLIB_COMPILER_ID #if defined(__SYSC__) #define RLIB_COMPILER_ID CC_DIGNUS #endif #endif -#define CC_DIGNUS 90732 +#define CC_DIGNUS 90737 #ifndef RLIB_COMPILER_ID #if defined(__DJGPP__) #define RLIB_COMPILER_ID CC_DJGPP #endif #endif -#define CC_DJGPP 90733 - -#ifndef RLIB_COMPILER_ID -#if defined(__ICC) || defined(__INTEL_COMPILER) -#define RLIB_COMPILER_ID CC_ICC -#endif -#endif -#define CC_ICC 90734 - -#ifndef RLIB_COMPILER_ID -#if defined(__EDG__) -#define RLIB_COMPILER_ID CC_EDG -#endif -#endif -#define CC_EDG 90735 +#define CC_DJGPP 90738 #ifndef RLIB_COMPILER_ID #if defined(__PATHCC__) #define RLIB_COMPILER_ID CC_EKOPATH #endif #endif -#define CC_EKOPATH 90736 +#define CC_EKOPATH 90739 #ifndef RLIB_COMPILER_ID #if defined(__FCC_VERSION) #define RLIB_COMPILER_ID CC_FUJITSU #endif #endif -#define CC_FUJITSU 90737 - -#ifndef RLIB_COMPILER_ID -#if defined(__GNUC__) -#define RLIB_COMPILER_ID CC_GCC -#endif -#endif -#define CC_GCC 90738 +#define CC_FUJITSU 90740 #ifndef RLIB_COMPILER_ID #if defined(__ghs__) #define RLIB_COMPILER_ID CC_GREENHILL #endif #endif -#define CC_GREENHILL 90739 +#define CC_GREENHILL 90741 #ifndef RLIB_COMPILER_ID #if defined(__HP_cc) #define RLIB_COMPILER_ID CC_HPC #endif #endif -#define CC_HPC 90740 +#define CC_HPC 90742 #ifndef RLIB_COMPILER_ID #if defined(__HP_aCC) #define RLIB_COMPILER_ID CC_HPACXX #endif #endif -#define CC_HPACXX 90741 +#define CC_HPACXX 90743 #ifndef RLIB_COMPILER_ID #if defined(__IAR_SYSTEMS_ICC__) #define RLIB_COMPILER_ID CC_IARC #endif #endif -#define CC_IARC 90742 +#define CC_IARC 90744 #ifndef RLIB_COMPILER_ID #if defined(__IBMCPP__) || defined(__IBMC__) #define RLIB_COMPILER_ID CC_IBMC #endif #endif -#define CC_IBMC 90743 +#define CC_IBMC 90745 #ifndef RLIB_COMPILER_ID #if defined(__IMAGECRAFT__) #define RLIB_COMPILER_ID CC_IMAGECRAFT #endif #endif -#define CC_IMAGECRAFT 90744 +#define CC_IMAGECRAFT 90746 #ifndef RLIB_COMPILER_ID #if defined(__KCC) #define RLIB_COMPILER_ID CC_KAICXX #endif #endif -#define CC_KAICXX 90745 +#define CC_KAICXX 90747 #ifndef RLIB_COMPILER_ID #if defined(__CA__) || defined(__KEIL__) #define RLIB_COMPILER_ID CC_KEIL_CARM #endif #endif -#define CC_KEIL_CARM 90746 +#define CC_KEIL_CARM 90748 #ifndef RLIB_COMPILER_ID #if defined(__C166__) #define RLIB_COMPILER_ID CC_KEIL_C166 #endif #endif -#define CC_KEIL_C166 90747 +#define CC_KEIL_C166 90749 #ifndef RLIB_COMPILER_ID #if defined(__C51__) || defined(__CX51__) #define RLIB_COMPILER_ID CC_KEIL_C51 #endif #endif -#define CC_KEIL_C51 90748 +#define CC_KEIL_C51 90750 #ifndef RLIB_COMPILER_ID #if defined(__LCC__) #define RLIB_COMPILER_ID CC_LCC #endif #endif -#define CC_LCC 90749 - -#ifndef RLIB_COMPILER_ID -#if defined(__llvm__) -#define RLIB_COMPILER_ID CC_LLVM -#endif -#endif -#define CC_LLVM 90750 +#define CC_LCC 90751 #ifndef RLIB_COMPILER_ID #if defined(__MWERKS__) || defined(__CWCC__) #define RLIB_COMPILER_ID CC_METROWERKS #endif #endif -#define CC_METROWERKS 90751 - -#ifndef RLIB_COMPILER_ID -#if defined(_MSC_VER) -#define RLIB_COMPILER_ID CC_MSVC -#endif -#endif -#define CC_MSVC 90752 +#define CC_METROWERKS 90752 #ifndef RLIB_COMPILER_ID #if defined(_MRI) @@ -391,105 +391,98 @@ #endif #define CC_SCO_OPENSERVER 90769 -#ifndef RLIB_COMPILER_ID -#if defined(SDCC) -#define RLIB_COMPILER_ID CC_SDCC -#endif -#endif -#define CC_SDCC 90770 - #ifndef RLIB_COMPILER_ID #if defined(__SNC__) #define RLIB_COMPILER_ID CC_SN #endif #endif -#define CC_SN 90771 +#define CC_SN 90770 #ifndef RLIB_COMPILER_ID #if defined(__VOSC__) #define RLIB_COMPILER_ID CC_STRATUS_VOS #endif #endif -#define CC_STRATUS_VOS 90772 +#define CC_STRATUS_VOS 90771 #ifndef RLIB_COMPILER_ID #if defined(__SC__) #define RLIB_COMPILER_ID CC_SYMANTEC #endif #endif -#define CC_SYMANTEC 90773 +#define CC_SYMANTEC 90772 #ifndef RLIB_COMPILER_ID #if defined(__TenDRA__) #define RLIB_COMPILER_ID CC_TENDRA #endif #endif -#define CC_TENDRA 90774 +#define CC_TENDRA 90773 #ifndef RLIB_COMPILER_ID #if defined(__TI_COMPILER_VERSION__) || defined(_TMS320C6X) #define RLIB_COMPILER_ID CC_TEXAS #endif #endif -#define CC_TEXAS 90775 +#define CC_TEXAS 90774 #ifndef RLIB_COMPILER_ID #if defined(THINKC3) || defined(THINKC4) #define RLIB_COMPILER_ID CC_THINK #endif #endif -#define CC_THINK 90776 +#define CC_THINK 90775 #ifndef RLIB_COMPILER_ID #if defined(__TINYC__) #define RLIB_COMPILER_ID CC_TINYC #endif #endif -#define CC_TINYC 90777 +#define CC_TINYC 90776 #ifndef RLIB_COMPILER_ID #if defined(__TURBOC__) #define RLIB_COMPILER_ID CC_TURBOC #endif #endif -#define CC_TURBOC 90778 +#define CC_TURBOC 90777 #ifndef RLIB_COMPILER_ID #if defined(_UCC) #define RLIB_COMPILER_ID CC_UCC #endif #endif -#define CC_UCC 90779 +#define CC_UCC 90778 #ifndef RLIB_COMPILER_ID #if defined(__USLC__) #define RLIB_COMPILER_ID CC_USLC #endif #endif -#define CC_USLC 90780 +#define CC_USLC 90779 #ifndef RLIB_COMPILER_ID #if defined(__VBCC__) #define RLIB_COMPILER_ID CC_VBCC #endif #endif -#define CC_VBCC 90781 +#define CC_VBCC 90780 #ifndef RLIB_COMPILER_ID #if defined(__WATCOMC__) #define RLIB_COMPILER_ID CC_WATCOM #endif #endif -#define CC_WATCOM 90782 +#define CC_WATCOM 90781 #ifndef RLIB_COMPILER_ID #if defined(__ZTC__) #define RLIB_COMPILER_ID CC_ZORTECH #endif #endif -#define CC_ZORTECH 90783 +#define CC_ZORTECH 90782 #ifndef RLIB_COMPILER_ID #define RLIB_COMPILER_ID CC_UNKNOWN #endif -#define CC_UNKNOWN 90784 +#define CC_UNKNOWN 90783 -- GitLab