No. Per the embedded C standard, __xdata is a named address space qualifier. C allows qualifiers on return types (but they re meaningless), so I think we need to allow this.
IMO, the bug here is a just missing W_QUALIFIED_RETURN warning.
P.S.: actually, there is already a comment about this in SDCCsymt.c:
// TODO: we probably should remove named address space qualifiers// for intrinsic named address spaces, too.
Last edit: Maarten Brock 2026-09-13
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'm a bit uncertain about the DECL case. It's been a while since I worked with storage class for declarators. I seem to remember it is stored in the etype.
Looks good to me. Should probably get a test in support/valdiag/tests. Maybe add it to support/valdiag/tests/bug-3964.c? Or introduce a new support/valdiag/tests/bug-4078.c?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Before creating a new valdiag test, I first dug a little deeper in the valdiag testing. In [r16877] I have updated valdiag.py so it now differentiates between errors and warnings. This brought several misconfigured tests to the surface which were also updated.
This also brought to light a bug in SDCCicode.c for pre-/post-inc/dec of pointers to incomplete structs which is now fixed.
No. Per the embedded C standard,
__xdatais a named address space qualifier. C allows qualifiers on return types (but they re meaningless), so I think we need to allow this.IMO, the bug here is a just missing W_QUALIFIED_RETURN warning.
P.S.: actually, there is already a comment about this in SDCCsymt.c:
Last edit: Maarten Brock 2026-09-13
OK, I can accept that. How about this patch?
I'm a bit uncertain about the DECL case. It's been a while since I worked with storage class for declarators. I seem to remember it is stored in the etype.
Looks good to me. Should probably get a test in support/valdiag/tests. Maybe add it to support/valdiag/tests/bug-3964.c? Or introduce a new support/valdiag/tests/bug-4078.c?
Before creating a new valdiag test, I first dug a little deeper in the valdiag testing. In [r16877] I have updated valdiag.py so it now differentiates between errors and warnings. This brought several misconfigured tests to the surface which were also updated.
This also brought to light a bug in SDCCicode.c for pre-/post-inc/dec of pointers to incomplete structs which is now fixed.
Related
Commit: [r16877]