Skip to content

Commit

Permalink
[libc] Fix lint message (#73956)
Browse files Browse the repository at this point in the history
  • Loading branch information
gchatelet committed Dec 1, 2023
1 parent d48d1ed commit 9557fcc
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
2 changes: 2 additions & 0 deletions libc/src/__support/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ add_header_library(
str_to_num_result
HDRS
str_to_num_result.h
DEPENDS
libc.src.__support.macros.attributes
)

add_header_library(
Expand Down
13 changes: 8 additions & 5 deletions libc/src/__support/str_to_num_result.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
#ifndef LLVM_LIBC_SRC___SUPPORT_STR_TO_NUM_RESULT_H
#define LLVM_LIBC_SRC___SUPPORT_STR_TO_NUM_RESULT_H

#include "src/__support/macros/attributes.h" // LIBC_INLINE

#include <stddef.h>

namespace LIBC_NAMESPACE {
Expand All @@ -18,15 +20,16 @@ template <typename T> struct StrToNumResult {
int error;
ptrdiff_t parsed_len;

constexpr StrToNumResult(T value) : value(value), error(0), parsed_len(0) {}
constexpr StrToNumResult(T value, ptrdiff_t parsed_len)
LIBC_INLINE constexpr StrToNumResult(T value)
: value(value), error(0), parsed_len(0) {}
LIBC_INLINE constexpr StrToNumResult(T value, ptrdiff_t parsed_len)
: value(value), error(0), parsed_len(parsed_len) {}
constexpr StrToNumResult(T value, ptrdiff_t parsed_len, int error)
LIBC_INLINE constexpr StrToNumResult(T value, ptrdiff_t parsed_len, int error)
: value(value), error(error), parsed_len(parsed_len) {}

constexpr bool has_error() { return error != 0; }
LIBC_INLINE constexpr bool has_error() { return error != 0; }

constexpr operator T() { return value; }
LIBC_INLINE constexpr operator T() { return value; }
};
} // namespace LIBC_NAMESPACE

Expand Down
3 changes: 1 addition & 2 deletions utils/bazel/llvm-project-overlay/libc/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -474,8 +474,7 @@ libc_support_library(
libc_support_library(
name = "__support_str_to_num_result",
hdrs = ["src/__support/str_to_num_result.h"],
deps = [
],
deps = [":__support_macros_attributes"],
)

libc_support_library(
Expand Down

0 comments on commit 9557fcc

Please sign in to comment.