Changeset 58e0d3c


Ignore:
Timestamp:
Dec 8, 2021, 7:46:13 AM (2 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, ast-experimental, enum, forall-pointer-decay, master, pthread-emulation, qualifiedEnum
Children:
a499702
Parents:
88792f3
Message:

clean up code for assembler check

File:
1 edited

Legend:

Unmodified
Added
Removed
  • driver/as.cc

    r88792f3 r58e0d3c  
    1111// Created On       : Wed Aug  1 10:49:42 2018
    1212// Last Modified By : Peter A. Buhr
    13 // Last Modified On : Tue Dec  7 21:15:25 2021
    14 // Update Count     : 132
     13// Last Modified On : Wed Dec  8 07:34:12 2021
     14// Update Count     : 135
    1515//
    1616
     
    5050                                        cursor = strstr( cursor, "\n" ) + 1;
    5151                                } // for
    52                                 cursor -= 1;                                                    // backup over '\n'
     52                                cursor -= 2;                                                    // backup over "d\n", where d is a hex digit
    5353                                // From elfcpp/dwarf.h in the binutils source tree.
    5454                                // DW_LANG_C89 = 0x1, DW_LANG_C = 0x2, DW_LANG_C99 = 0xc, DW_LANG_C11 = 0x1d
    55                                 if ( *(cursor - 3) == '0' && *(cursor - 2) == 'x' &&
    56                                          (*(cursor - 1) == 'c' || *(cursor - 1) == '1' || *(cursor - 1) == '2') ) { // C89/C/C99
     55                                if ( *(cursor - 2) == '0' && *(cursor - 1) == 'x' &&
     56                                         (*cursor == 'c' || *cursor == '1' || *cursor == '2') ) { // C99/C89/C
    5757                                        // Expand file by one byte to hold 2 character Cforall language code.
    5858                                        if ( ftruncate( fd, size + 1 ) ) { perror( "ftruncate" ); exit( EXIT_FAILURE ); };
    59                                         memmove( cursor + 1, cursor, start + size - cursor ); // move remaining text 1 character right
    60                                 } else if ( *(cursor - 4) == '0' && *(cursor - 3) == 'x' && *(cursor - 2) == '1' && *(cursor - 1) == 'd' ) { // C11
     59                                        memmove( cursor + 2, cursor + 1, start + size - cursor - 1 ); // move remaining text 1 character right
     60                                } else if ( *(cursor - 3) == '0' && *(cursor - 2) == 'x' && *(cursor - 1) == '1' && *cursor == 'd' ) { // C11
    6161                                } else {
    6262                                        for ( int i = 0; i < 6; i += 1 ) {      // move N (magic) lines forward
     
    6969                                } // if
    7070
    71                                 *(cursor - 2) = '2';                                    // replace C89/C/C99/C11 language code with CFA code
    72                                 *(cursor - 1) = '5';
     71                                *(cursor - 1) = '2';                                    // replace C89/C/C99/C11 language code with CFA code
     72                                *cursor = '5';
    7373                        } // if
    7474                } // if
Note: See TracChangeset for help on using the changeset viewer.