Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pre Release (v3.8.0-beta.3): Add simple bsearch, memchr implementation #485

Merged
merged 13 commits into from
Jan 25, 2023

Conversation

sksat
Copy link
Collaborator

@sksat sksat commented Jan 24, 2023

概要

  • Library に libc ディレクトリを追加し,bsearch(), memchr を提供する
  • これらの関数を使うための CMake option USE_SIMPLE_LIBC を追加する(デフォルトOFF)

Issue

  • 関連する issue

詳細

C2A が依存するいくつかの libc 関数を自前実装し,c2a-core から提供することで,C2A の移植性を高める.
これにより,ベアメタル環境でも C2A を libc 無しに(newlib などを持ち出してくることなく)ビルド・動作させることができる.

備考

本 core を使いたい user があるため,pre release を打つ

@sksat sksat added the enhancement New feature or request label Jan 24, 2023
@sksat sksat requested a review from meltingrabbit January 24, 2023 21:31
@sksat sksat self-assigned this Jan 24, 2023
Library/libc/memchr.c Outdated Show resolved Hide resolved
Library/libc/memchr.c Outdated Show resolved Hide resolved
Library/libc/bsearch.c Outdated Show resolved Hide resolved
Library/libc/bsearch.c Outdated Show resolved Hide resolved
Library/libc/bsearch.c Outdated Show resolved Hide resolved
Library/libc/bsearch.c Outdated Show resolved Hide resolved
Library/libc/bsearch.c Outdated Show resolved Hide resolved
Library/libc/bsearch.c Outdated Show resolved Hide resolved
Library/libc/bsearch.c Outdated Show resolved Hide resolved
Library/libc/bsearch.c Outdated Show resolved Hide resolved
Library/libc/memchr.c Outdated Show resolved Hide resolved
@sksat
Copy link
Collaborator Author

sksat commented Jan 24, 2023

一瞬ビルド対象に入れて CI 通す

while (min < max)
{
size_t index = (min + max) / 2;
void* current = (void*) (base + (size * index));

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [clang-tidy(Werror)] reported by reviewdog 🐶
arithmetic on a pointer to void is a GNU extension [clang-diagnostic-pointer-arith]
void* current = (void*) (base + (size * index));
^

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

そうなんだ

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

サイズわからないからそれはそうだ

@sksat
Copy link
Collaborator Author

sksat commented Jan 24, 2023

S2E mockup と build with S2E が落ちてるのは MSVC++ で executable ビルドしてて本物の libc と衝突してるから

@sksat
Copy link
Collaborator Author

sksat commented Jan 24, 2023

SILS mockup でも executable にしてるので本物の libc と衝突自体はすると思うけど落ちてないのはたぶんリンカが察してくれてる(明示的に指定したライブラリの方が優先順位が高い).

@sksat
Copy link
Collaborator Author

sksat commented Jan 24, 2023

bsearch(),OSDNのexampleで試したら微妙にバグってるじゃんか

@sksat
Copy link
Collaborator Author

sksat commented Jan 24, 2023

min < max じゃん.それはそう.

@sksat
Copy link
Collaborator Author

sksat commented Jan 25, 2023

CMake option は C2A_ みたいな prefix が付いてた方がいいかもな

@sksat
Copy link
Collaborator Author

sksat commented Jan 25, 2023

要望: AE内部でこれを使う C2A user があるので,マージ後に Pre Release 打ってほしい

@meltingrabbit
Copy link
Collaborator

meltingrabbit commented Jan 25, 2023

OK.そしたら最後マージする前にいって.このPRでバージョンファイル書き換えないといけない

https://github.com/ut-issl/c2a-core/blob/develop/Docs/General/release.md

@meltingrabbit meltingrabbit changed the title Add simple bsearch, memchr implementation Pre Release (v3.8.0-beta.3): Add simple bsearch, memchr implementation Jan 25, 2023
@meltingrabbit
Copy link
Collaborator

@sksat
bace04e

OK?

Library/libc/bsearch.c Outdated Show resolved Hide resolved
@meltingrabbit
Copy link
Collaborator

@sksat レビューはOK

cmakelistなおしてもらってCIとおったらバージョン上げてapproveします

@sksat
Copy link
Collaborator Author

sksat commented Jan 25, 2023

LGTM to comment

@meltingrabbit
Copy link
Collaborator

CIとおったね.

Copy link
Collaborator

@meltingrabbit meltingrabbit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK

マージ後tagうちます

@sksat
Copy link
Collaborator Author

sksat commented Jan 25, 2023

version 番号上げてないので上げる

@meltingrabbit
Copy link
Collaborator

いや,あげてるよ

@sksat
Copy link
Collaborator Author

sksat commented Jan 25, 2023

上がってた

@meltingrabbit
Copy link
Collaborator

@sksat merge ready

@meltingrabbit meltingrabbit added the priority::high priorityg high label Jan 25, 2023
@sksat sksat merged commit d78c1ea into develop Jan 25, 2023
@sksat sksat deleted the feature/simple-libc branch January 25, 2023 05:34
@meltingrabbit
Copy link
Collaborator

リリース打ちました

https://github.com/ut-issl/c2a-core/releases/tag/v3.8.0-beta.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request priority::high priorityg high
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants