From e5f86599e40615c659952e3fd93ad9df96c2a844 Mon Sep 17 00:00:00 2001 From: Anghelo Carvajal Date: Sun, 21 Jan 2024 20:28:55 -0300 Subject: [PATCH] CI fixes (#8) * touch c-parse.c * Run CI on pull requests * update some actions * Copy over egcs ci stuff * remove uses of sys_nerr * fix typo * Yeet my_strerror --- .github/workflows/build.yml | 32 ++++++++++++++++----------- gcc.c | 44 +++---------------------------------- 2 files changed, 22 insertions(+), 54 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e3339cd..dbc8789 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,6 +1,6 @@ name: Build -on: [push] +on: [push, pull_request] jobs: build: @@ -22,44 +22,50 @@ jobs: ARCHIVE_NAME: 'gcc-2.7.2-mac.tar.gz' } - name: Building binutils for ${{ matrix.TARGET.OS }} + name: Building gcc for ${{ matrix.TARGET.OS }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Install dependencies (Ubuntu) shell: bash if: matrix.TARGET.OS == 'ubuntu-latest' run: | sudo apt-get update - sudo apt-get install -y build-essential bison file gperf gcc gcc-multilib + sudo apt-get install -y build-essential bison file gperf gcc gcc-multilib autoconf + - name: Configure for mips shell: bash run: | ./configure --target=mips-mips-gnu --prefix=/opt/cross --with-gnu-as --disable-gprof --disable-gdb --disable-werror --host=${{ matrix.TARGET.HOST }} --build=${{ matrix.TARGET.HOST }} + - name: Make - shell: bash + shell: bash # The generated `c-parse.c` is already commited on the repo, so we touch it to avoid regenerating it (trying to build old lex/yacc files with modern tools fails) run: | - make cpp cc1 xgcc cc1plus g++ CFLAGS="${{ matrix.TARGET.CFLAGS }}" + touch c-parse.c + make CFLAGS="${{ matrix.TARGET.CFLAGS }}" xgcc cc1 cc1plus cpp cccp g++ + - name: Test for file shell: bash run: | test -f cc1 file cc1 ./cc1 test.c + - name: Create release archive shell: bash run: | cp xgcc gcc - tar -czf ${{ matrix.TARGET.ARCHIVE_NAME }} cpp cc1 gcc cc1plus g++ + tar -czf ${{ matrix.TARGET.ARCHIVE_NAME }} gcc cc1 cc1plus cpp cccp g++ + - name: Upload archive - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: - name: binutils-2.7.2-${{ matrix.TARGET.OS }} + name: gcc-2.7.2-${{ matrix.TARGET.OS }} path: | ${{ matrix.TARGET.ARCHIVE_NAME }} - - name: Update release - uses: johnwbyrd/update-release@v1.0.0 - if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} + + - name: Publish release + uses: softprops/action-gh-release@v1 + if: startsWith(github.ref, 'refs/tags/') with: - token: ${{ secrets.GITHUB_TOKEN }} files: ${{ matrix.TARGET.ARCHIVE_NAME }} diff --git a/gcc.c b/gcc.c index 905833c..d83281c 100644 --- a/gcc.c +++ b/gcc.c @@ -1020,28 +1020,6 @@ translate_options (argcp, argvp) *argcp = newindex; } -char * -my_strerror(e) - int e; -{ - -#ifdef HAVE_STRERROR - return strerror(e); - -#else - - static char buffer[30]; - if (!e) - return ""; - - if (e > 0 && e < sys_nerr) - return sys_errlist[e]; - - sprintf (buffer, "Unknown error %d", e); - return buffer; -#endif -} - /* Read compilation specs from a file named FILENAME, replacing the default ones. @@ -4731,26 +4709,14 @@ static void pfatal_with_name (name) char *name; { - char *s; - - if (errno < sys_nerr) - s = concat ("%s: ", my_strerror( errno )); - else - s = "cannot open `%s'"; - fatal (s, name); + fatal ("%s: %s", name, strerror (errno)); } static void perror_with_name (name) char *name; { - char *s; - - if (errno < sys_nerr) - s = concat ("%s: ", my_strerror( errno )); - else - s = "cannot open `%s'"; - error (s, name); + error ("%s: %s", name, strerror (errno)); } static void @@ -4759,11 +4725,7 @@ perror_exec (name) { char *s; - if (errno < sys_nerr) - s = concat ("installation problem, cannot exec `%s': ", - my_strerror (errno)); - else - s = "installation problem, cannot exec `%s'"; + s = concat ("installation problem, cannot exec `%s': ", strerror (errno)); error (s, name); }