MCC EUSART code to read from the circular buffer will decrement the counter when reading from the input buffer.
But anyway, such code that change the same variable both in Interrupt and in Main loop code,
is vulnerable to obscure synchronization problems.
8 bit PIC microcontrollers are able to increment or decrement a 8 bit variable in a single atomic instruction,
so the test suggested in message #1 seem sensible to me.
Another possibility, is to avoid the counter variable entirely, using the 2 separate index variables:
eusart1RxHead and eusart1RxTail,
also when testing if buffer contain data.
One of these variables are only updated by interrupt code, the other only by code in API routines.
There are some boundary cases, so one byte in the buffer array may have to remain unused,
while a separate counter variable may not be needed.
In the code generated by MCC, there is the following construct in the eusartRead() function:
PIE1bits.RCIE = 0;
PIE1bits.RCIE = 1;
disabling EUSART interrupt while manipulating the counter.
In view that 8 bit PIC have instruction to decrement a 8 bit variable in a atomic instruction?
Also the code generated have a status array using the same number of bytes as the circular buffer.
The Status type have bits to indicate, parity error, framing error or hardware overrun error,
but nothing to record or notify that software buffer overflow have occurred.