[all-commits] [llvm/llvm-project] ddae13: [libc] fix scanf error handling

michaelrj-google via All-commits all-commits at lists.llvm.org
Tue Dec 13 12:51:42 PST 2022

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: ddae13c30357087797991ebd59e200abe34bd800
  Author: Michael Jones <michaelrj at google.com>
  Date:   2022-12-13 (Tue, 13 Dec 2022)

  Changed paths:
    M libc/src/stdio/scanf_core/file_reader.h
    M libc/src/stdio/scanf_core/reader.cpp
    M libc/src/stdio/scanf_core/reader.h
    M libc/src/stdio/scanf_core/scanf_main.cpp

  Log Message:
  [libc] fix scanf error handling

Scanf is supposed to return EOF when it fails to make any conversions
and there is an input failure. Previously it would return EOF on a
matching failure, which may be an input failure but can also be a
parsing error.

Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D139891

  Commit: 65f4cc63102aa77c49c63826ec55af0582c3d8ed
  Author: Michael Jones <michaelrj at google.com>
  Date:   2022-12-13 (Tue, 13 Dec 2022)

  Changed paths:
    M libc/src/stdio/scanf_core/CMakeLists.txt
    M libc/src/stdio/scanf_core/converter.cpp
    A libc/src/stdio/scanf_core/int_converter.cpp
    A libc/src/stdio/scanf_core/int_converter.h
    M libc/test/src/stdio/sscanf_test.cpp

  Log Message:
  [libc] add scanf int conversions

This patch adds the integer conversions %d/i/u/o/x/X to scanf as well as
unit tests to check their correctness.

Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D138880

Compare: https://github.com/llvm/llvm-project/compare/c8647738cd65...65f4cc63102a

More information about the All-commits mailing list