Changeset 130a778 for driver/as.cc


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

add debug C11 code to assembler check

File:
1 edited

Legend:

Unmodified
Added
Removed
  • driver/as.cc

    r63f2697 r130a778  
    1111// Created On       : Wed Aug  1 10:49:42 2018
    1212// Last Modified By : Peter A. Buhr
    13 // Last Modified On : Tue Dec  7 16:56:24 2021
    14 // Update Count     : 115
     13// Last Modified On : Tue Dec  7 20:49:15 2021
     14// Update Count     : 121
    1515//
    1616
     
    5151                if ( (dcursor = strstr( start, ".Ldebug_info0:" ) ) ) { // debug information ?
    5252
    53                         if ( char * cursor = strstr( dcursor, ".long\t.LASF" ) ) { // debug information ?
     53                        if ( char * cursor = strstr( dcursor, ".long\t.LASF" ) ) { // language code ?
    5454                                for ( int i = 0; i < 2; i += 1 ) {              // move N (magic) lines forward
    5555                                        cursor = strstr( cursor, "\n" ) + 1;
    5656                                } // for
    57 
    58                                 cursor -= 2;                                                    // backup over "c\n" language value
    59                                 if ( *(cursor - 1) != 'x' ) {                   // 0x before code
     57                                cursor -= 1;                                                    // backup over '\n'
     58                                if ( (*(cursor - 3) == '0' && *(cursor - 2) == 'x' && *(cursor - 1) == 'c') ) { // 0xc => C99
     59                                        // Expand file by one byte to hold 2 character Cforall language code.
     60                                        if ( ftruncate( fd, size + 1 ) ) { perror( "ftruncate" ); exit( EXIT_FAILURE ); };
     61                                        memmove( cursor + 1, cursor, start + size - cursor ); // move remaining text 1 character right
     62                                } else if ( *(cursor - 4) == '0' && *(cursor - 3) == 'x' && *(cursor - 2) == '1' && *(cursor - 1) == 'd' ) { // 0x1d => C11
     63                                        // replace "1d" with "25"
     64                                } else {
    6065                                        for ( int i = 0; i < 6; i += 1 ) {      // move N (magic) lines forward
    6166                                                cursor = strstr( cursor, "\n" ) + 1;
     
    6570                                                         argv[argc - 1], (int)(cursor - dcursor), dcursor );
    6671                                        exit( EXIT_FAILURE );
    67                                 };
     72                                } // if
    6873
    69                                 // Expand file by one byte to hold 2 character Cforall language code.
    70                                 if ( ftruncate( fd, size + 1 ) ) { perror( "ftruncate" ); exit( EXIT_FAILURE ); };
    71 
    72                                 memmove( cursor + 2, cursor + 1, start + size - cursor - 1 ); // move remaining text 1 character right
    73 
    74                                 *(cursor) = '2';                                                // replace C language value with CFA
    75                                 *(cursor + 1) = '5';
     74                                *(cursor - 2) = '2';                                    // replace C/C11 language value with CFA
     75                                *(cursor - 1) = '5';
    7676                        } // if
    7777                } // if
Note: See TracChangeset for help on using the changeset viewer.