Could __builtin_printf parameters be optimized when being compiled

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi
Has GCC considered an improvement to "compile out" from the builtin printf the strings? That being to change it to just be something like puts("file /app/example.cpp:4")
I had a look, but couldn't find it being asked before.

This is just a short example to demonstrate.
It would be useful to see the exact string in the debugger "file /app/example.cpp:4", also it saves a few lines of asm.

https://godbolt.org/z/aKz3o6aPd


int main()
{
    __builtin_printf("file %s:%d", __FILE__, __LINE__);
}


.LC0:
        .string "/app/example.cpp"
.LC1:
        .string "file %s:%d"
main:
        subq    $8, %rsp
        movl    $4, %edx
        movl    $.LC0, %esi
        xorl    %eax, %eax
        movl    $.LC1, %edi
        call    printf
        xorl    %eax, %eax
        addq    $8, %rsp
        ret



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux