https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111669

--- Comment #5 from Xi Ruoyao <xry111 at gcc dot gnu.org> ---
And you can tell the compiler some fact about the semantics of the Windoge API
functions if you really need -Werror=nonnull (though I cannot see any reason
you must use -Werror here):

int GetSystemDirectory16(char *path, int count)
{
    if (GetWindowsDirectoryA()) {
        /* For blah blah blah... reason
           path will never be NULL if GetWindowsDirectoryA returns true */
        if (!path)
            __builtin_unreachable();

        __builtin_strcpy(path, "foo");
    }

    return 0;
}

Reply via email to