Commit Graph

17 Commits

Author SHA1 Message Date
Ali Mohammad Pur
5e1499d104 Everywhere: Rename {Deprecated => Byte}String
This commit un-deprecates DeprecatedString, and repurposes it as a byte
string.
As the null state has already been removed, there are no other
particularly hairy blockers in repurposing this type as a byte string
(what it _really_ is).

This commit is auto-generated:
  $ xs=$(ack -l \bDeprecatedString\b\|deprecated_string AK Userland \
    Meta Ports Ladybird Tests Kernel)
  $ perl -pie 's/\bDeprecatedString\b/ByteString/g;
    s/deprecated_string/byte_string/g' $xs
  $ clang-format --style=file -i \
    $(git diff --name-only | grep \.cpp\|\.h)
  $ gn format $(git ls-files '*.gn' '*.gni')
2023-12-17 18:25:10 +03:30
implicitfield
5dfe2eb389 Everywhere: Resolve conflicts with LibC and libc++
Since https://reviews.llvm.org/D131441, libc++ must be included before
LibC. As clang includes libc++ as one of the system includes, LibC
must be included after those, and the only correct way to do that is
to install LibC's headers into the sysroot.

Targets that don't link with LibC yet require its headers for one
reason or another must add install_libc_headers as a dependency to
ensure that the correct headers have been (re)installed into the
sysroot.

LibC/stddef.h has been dropped since the built-in stddef.h receives
a higher include priority.

In addition, string.h and wchar.h must
define __CORRECT_ISO_CPP_STRING_H_PROTO and
_LIBCPP_WCHAR_H_HAS_CONST_OVERLOADS respectively in order to tell
libc++ to not try to define methods implemented by LibC.
2023-06-27 12:40:38 +02:00
Tim Schumacher
cda4034b46 LibCrypt: Start installing headers again
This was accidentally broken in
ac40197047, after which we started
installing headers into a `LibCrypt` subdirectory instead.

`serenity_install_headers("")` is really the only thing that we need
from `serenity_libc`, so just replicate that manually.
2023-03-20 09:33:30 +01:00
Jelle Raaijmakers
25f2e4981c AK: Stop using DeprecatedString in Base64 encoding 2022-12-20 10:34:19 +01:00
Linus Groh
6e19ab2bbc AK+Everywhere: Rename String to DeprecatedString
We have a new, improved string type coming up in AK (OOM aware, no null
state), and while it's going to use UTF-8, the name UTF8String is a
mouthful - so let's free up the String name by renaming the existing
class.
Making the old one have an annoying name will hopefully also help with
quick adoption :^)
2022-12-06 08:54:33 +01:00
Jelle Raaijmakers
f0a4cc2d80 LibCrypt: Clean up crypt_r
Remove an unused constant, use a C++-style `reinterpret_cast` and employ
an early return to remove excessive indentation. No functional changes.
2022-11-24 10:52:10 +00:00
Tim Schumacher
ce2f1b845f Everywhere: Mark dependencies of most targets as PRIVATE
Otherwise, we end up propagating those dependencies into targets that
link against that library, which creates unnecessary link-time
dependencies.

Also included are changes to readd now missing dependencies to tools
that actually need them.
2022-11-01 14:49:09 +00:00
Tim Schumacher
7834e26ddb Everywhere: Explicitly link all binaries against the LibC target
Even though the toolchain implicitly links against -lc, it does not know
where it should get LibC from except for the sysroot. In the case of
Clang this causes it to pick up the LibC stub instead, which might be
slightly outdated and feature missing symbols.

This is currently not an issue that manifests because we pass through
the dependency on LibC and other libraries by accident, which causes
CMake to link against the LibC target (instead of just the library),
and thus points the linker at the build output directory.

Since we are looking to fix that in the upcoming commits, let's make
sure that everything will still be able to find the proper LibC first.
2022-11-01 14:49:09 +00:00
Tim Schumacher
ac40197047 LibCrypt: Define it as a normal library
LibCrypt has no need for being -nostdlib, especially since we just link
in LibC manually anyways.
2022-11-01 14:49:09 +00:00
sin-ack
c70f45ff44 Everywhere: Explicitly specify the size in StringView constructors
This commit moves the length calculations out to be directly on the
StringView users. This is an important step towards the goal of removing
StringView(char const*), as it moves the responsibility of calculating
the size of the string to the user of the StringView (which will prevent
naive uses causing OOB access).
2022-07-12 23:11:35 +02:00
Idan Horowitz
086969277e Everywhere: Run clang-format 2022-04-01 21:24:45 +01:00
Andrew Kaster
e687e5ba74 LibCrypt: Link the SHA2 hash implementation into LibCrypt privately
Previously, we linked LibCrypt against LibCrypto. This creates a
circular symbol dependency between LibCore, LibCrypto and LibCrypt.
LibCrypto uses Core::DateTime, LibCrypt uses Crypto::SHA2, and LibCore
uses crypt in Core::Account. The GNU toolchain massages the DT_NEEDED
lines of each library and applications that use each library such that
the Loader finds all the symbols as necessary. However, when using the
Clang toolchain, the circular library dependency is not as tolerated.
We get a symbol not found error in the Loader at runtime, and the app in
question crashes.

Now, we build the SHA2.cpp implementation file into LibCrypt using an
object library and `-fvisibility=hidden -fvisibility-hidden-inlines`.
This adds the implementation in a way that only creates STB_LOCAL
symbols and should avoid nasty ODR problems in the future.

An alternative approach to resolving this dependency would be to move
Core::DateTime to AK, or to make Crypto::ASN1::parse_utc_date return a
struct tm instead of a Core::DateTime. One of those approaches to
remove the LibCore dependency from LibCrypto should probabably be
investigated further in the future.

The net effect of removing this circular library dependency is that one
can now build and run the python3 port with the Clang toolchain :^)
2022-01-08 18:56:29 +01:00
Peter Elliott
33d7fdca28 Everywhere: Use my cool new @serenityos.org email address 2021-09-01 11:37:25 +04:30
Linus Groh
d8a3609aa9 Everywhere: Add a blank line after copyright header where missing 2021-05-15 00:27:09 +01:00
Gunnar Beutner
ce77caf479 LibC: Move crypt() and crypt_r() to the right header file
According to POSIX.1 these should be in <crypt.h>.
2021-05-01 12:40:12 +02:00
Brian Gianforcaro
1682f0b760 Everything: Move to SPDX license identifiers in all files.
SPDX License Identifiers are a more compact / standardized
way of representing file license information.

See: https://spdx.dev/resources/use/#identifiers

This was done with the `ambr` search and replace tool.

 ambr --no-parent-ignore --key-from-file --rep-from-file key.txt rep.txt *
2021-04-22 11:22:27 +02:00
Andreas Kling
13d7c09125 Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00