• Nick Kralevich's avatar
    FORTIFY_SOURCE: optimize · a44e9afd
    Nick Kralevich authored
    Don't do the fortify_source checks if we can determine, at
    compile time, that the provided operation is safe.
    
    This avoids silliness like calling fortify source on things like:
    
      size_t len = strlen("asdf");
      printf("%d\n", len);
    
    and allows the compiler to optimize this code to:
    
      printf("%d\n", 4);
    
    Defer to gcc's builtin functions instead of pointing our code
    to the libc implementation.
    
    Change-Id: I5e1dcb61946461c4afaaaa983e39f07c7a0df0ae
    a44e9afd
string_test.cpp 19.9 KB