Suppress compiler warnings in HAL and Libraries only?

I am afraid to ask this question after reading some previous posts that state NEVER DISABLE WARNINGS and of course, modify the code to fix it. I certainly agree with that if it is my own code, but I am getting warnings from included libraries and from HAL itself.

Is there anyway to disable just library and deviceos warnings and just keep warnings for my own code? Or better yet, only enable warnings for any code in the src directory and it's subdirectories.

No, but I believe the warnings will be fixed in an upcoming Device OS version.

Some warnings on RTL872x devices were fixed in 5.8.2.

Dang. Oh well. Thanks @rickkas7

Btw, here is what I am seeing on 5.9.0

MCU/rtl872x/src/flash_mal.c: In function 'FLASH_CheckValidAddressRange':
MCU/rtl872x/src/flash_mal.c:324:29: warning: comparison of unsigned expression in '>= 0' is always true [-Wtype-limits]
  324 |         return startAddress >= 0x00000000 && endAddress < EXTERNAL_FLASH_SIZE;
      |                             ^~
In file included from ../../../hal/inc/interrupts_hal.h:39,
                 from ../../../hal/inc/core_hal.h:91,
                 from ../../../modules/shared/rtl872x/inc/user_part_export.c:7,
                 from src/user_export.c:1:
../../../hal/inc/pinmap_hal.h:92:1: warning: 'Hal_Pin_Info' is deprecated: Use hal_pin_info_t instead [-Wdeprecated-declarations]
   92 | Hal_Pin_Map(void) {
      | ^~~~~~~~~~~
In file included from ../../../hal/inc/pinmap_hal.h:77,
                 from ../../../hal/inc/interrupts_hal.h:39,
                 from ../../../hal/inc/core_hal.h:91,
                 from ../../../modules/shared/rtl872x/inc/user_part_export.c:7,
                 from src/user_export.c:1:
../../../hal/src/rtl872x/pinmap_impl.h:26:16: note: declared here
   26 | typedef struct hal_pin_info_t {
      |                ^~~~~~~~~~~~~~
In file included from ../../../hal/inc/interrupts_hal.h:234,
                 from ../../../hal/inc/core_hal.h:91,
                 from ../../../modules/shared/rtl872x/inc/user_part_export.c:7,
                 from src/user_export.c:1:
../../../hal/inc/interrupts_hal_compat.h:37:1: warning: 'HAL_InterruptHandler' is deprecated: Use hal_interrupt_handler_t [-Wdeprecated-declarations]
   37 | HAL_Interrupts_Attach(uint16_t pin, HAL_InterruptHandler handler, void* data, InterruptMode mode, HAL_InterruptExtraConfiguration* config) {
      | ^~~~~~~~~~~~~~~~~~~~~
../../../hal/inc/interrupts_hal_compat.h:37:1: warning: 'HAL_InterruptExtraConfiguration' is deprecated: Use hal_interrupt_extra_configuration_t [-Wdeprecated-declarations]
In file included from ../../../hal/inc/core_hal.h:91,
                 from ../../../modules/shared/rtl872x/inc/user_part_export.c:7,
                 from src/user_export.c:1:
../../../hal/inc/interrupts_hal.h:76:16: note: declared here
   76 | typedef struct hal_interrupt_extra_configuration_t {
      |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ../../../hal/inc/interrupts_hal.h:234,
                 from ../../../hal/inc/core_hal.h:91,
                 from ../../../modules/shared/rtl872x/inc/user_part_export.c:7,
                 from src/user_export.c:1:
../../../hal/inc/interrupts_hal_compat.h:77:1: warning: 'HAL_InterruptCallback' is deprecated: Use hal_interrupt_callback_t [-Wdeprecated-declarations]
   77 | HAL_Set_System_Interrupt_Handler(hal_irq_t irq, const HAL_InterruptCallback* callback, HAL_InterruptCallback* previous, void* reserved) {
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ../../../hal/inc/core_hal.h:91,
                 from ../../../modules/shared/rtl872x/inc/user_part_export.c:7,
                 from src/user_export.c:1:
../../../hal/inc/interrupts_hal.h:66:16: note: declared here
   66 | typedef struct hal_interrupt_callback_t {
      |                ^~~~~~~~~~~~~~~~~~~~~~~~
In file included from ../../../hal/inc/interrupts_hal.h:234,
                 from ../../../hal/inc/core_hal.h:91,
                 from ../../../modules/shared/rtl872x/inc/user_part_export.c:7,
                 from src/user_export.c:1:
../../../hal/inc/interrupts_hal_compat.h:77:1: warning: 'HAL_InterruptCallback' is deprecated: Use hal_interrupt_callback_t [-Wdeprecated-declarations]
   77 | HAL_Set_System_Interrupt_Handler(hal_irq_t irq, const HAL_InterruptCallback* callback, HAL_InterruptCallback* previous, void* reserved) {
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ../../../hal/inc/core_hal.h:91,
                 from ../../../modules/shared/rtl872x/inc/user_part_export.c:7,
                 from src/user_export.c:1:
../../../hal/inc/interrupts_hal.h:66:16: note: declared here
   66 | typedef struct hal_interrupt_callback_t {
      |                ^~~~~~~~~~~~~~~~~~~~~~~~
In file included from ../../../hal/inc/interrupts_hal.h:234,
                 from ../../../hal/inc/core_hal.h:91,
                 from ../../../modules/shared/rtl872x/inc/user_part_export.c:7,
                 from src/user_export.c:1:
../../../hal/inc/interrupts_hal_compat.h:82:1: warning: 'HAL_InterruptCallback' is deprecated: Use hal_interrupt_callback_t [-Wdeprecated-declarations]
   82 | HAL_Get_System_Interrupt_Handler(hal_irq_t irq, HAL_InterruptCallback* callback, void* reserved) {
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ../../../hal/inc/core_hal.h:91,
                 from ../../../modules/shared/rtl872x/inc/user_part_export.c:7,
                 from src/user_export.c:1:
../../../hal/inc/interrupts_hal.h:66:16: note: declared here
   66 | typedef struct hal_interrupt_callback_t {
      |                ^~~~~~~~~~~~~~~~~~~~~~~~
In file included from ../../../hal/inc/interrupts_hal.h:234,
                 from ../../../hal/inc/core_hal.h:91,
                 from ../../../modules/shared/rtl872x/inc/user_part_export.c:7,
                 from src/user_export.c:1:
../../../hal/inc/interrupts_hal_compat.h:92:1: warning: 'HAL_Direct_Interrupt_Handler' is deprecated: Use hal_interrupt_handler_t [-Wdeprecated-declarations]
   92 | HAL_Set_Direct_Interrupt_Handler(IRQn_Type irqn, HAL_Direct_Interrupt_Handler handler, uint32_t flags, void* reserved) {
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~