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

cleanup headers #339

Merged
merged 3 commits into from
Feb 7, 2024
Merged

cleanup headers #339

merged 3 commits into from
Feb 7, 2024

Conversation

lukileczo
Copy link
Member

@lukileczo lukileczo commented Feb 5, 2024

Description

Adapt headers for the common user- and kernel-space parts to be used from installed kernel headers, update types.

Motivation and Context

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

How Has This Been Tested?

  • Already covered by automatic testing.
  • New test added: (add PR link here).
  • Tested by hand on: (list targets here).

Checklist:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing linter checks and tests passed.
  • My changes generate no new compilation warnings for any of the targets.

Special treatment

unistd/alarm.c Outdated Show resolved Hide resolved
agkaminski
agkaminski previously approved these changes Feb 5, 2024
Copy link
Member

@anglov anglov left a comment

Choose a reason for hiding this comment

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

Major and nice refactoring. I am happy that we decided to clean up kernel-libphoenix includes.

You should probably add yourself as an author to files that you majorly changed.

This refactoring doesn't solve everything (eg. types.h should be modularized) to fully conform with POSIX, but it's major improvement.

I point small things that can improve your change a little.

arch/sparcv8leon3/reboot.c Show resolved Hide resolved
#elif defined(__CPU_IMXRT117X)
#include <phoenix/arch/imxrt1170.h>
#include <phoenix/arch/armv7m/imxrt/11xx/imxrt1170.h>
#else
Copy link
Member

@anglov anglov Feb 5, 2024

Choose a reason for hiding this comment

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

I know that's not your code but maybe:

Suggested change
#else
#elif defined(__CPU_IMXRT105X) || defined(__CPU_IMXRT106X)
#include <phoenix/arch/armv7m/imxrt/11xx/imxrt10xx.h>
#else
#error "Unsupported TARGET"
#endif

Note: maybe this ifdefined chain should be replaced by including one file, which will have those ifdefs?

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks, for now I'll leave the ifdefs as they are because they're only needed in one file, but if ever necessary elsewhere I agree that this could be moved to separate header.

Comment on lines 25 to 33
typedef __s8 int8_t;
typedef __s16 int16_t;
typedef __s32 int32_t;
typedef __s64 int64_t;

typedef unsigned char uint8_t;
typedef unsigned short uint16_t;
typedef unsigned int uint32_t;
typedef unsigned long long uint64_t;
typedef __u8 uint8_t;
typedef __u16 uint16_t;
typedef __u32 uint32_t;
typedef __u64 uint64_t;
Copy link
Member

Choose a reason for hiding this comment

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

Potentially it could be moved to generic include/stdint.h

Then we may want to not used it in least/fast/ptr/max types defined below or firstly typedef and then include.

side note: least type could also be moved to generic include/stdint.h in section
USE_STANDARD_TYPES_STDINT

include/stdio.h Show resolved Hide resolved
include/sys/time.h Outdated Show resolved Hide resolved
agkaminski
agkaminski previously approved these changes Feb 6, 2024
include/stdint.h Outdated
typedef uint32_t uint_least32_t;
typedef uint64_t uint_least64_t;

#ifdef _USE_STANDARD_TYPES_STDINT
Copy link
Member

Choose a reason for hiding this comment

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

To fully conform with idea of this define, this ifdef should be above /* 7.18.1.1 Exact-width integer types */

in fact C doesn't require to have uint(8/16/32/64)_t types defined.

It's minor as we don't want to support weird architectures but would be great to preserve idea here on wipe it out :)

@agkaminski agkaminski merged commit 8304743 into master Feb 7, 2024
7 of 22 checks passed
@agkaminski agkaminski deleted the lukileczo/headers branch February 7, 2024 11:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants