GLSL #line off by one

This is really just a cosmetic issue, but it’s a bit annoying.
C preprocessors get it right:

Example:
#line 10
#invalid_directive

nVidia drivers report error at line 11, the rest of the world 10

(I think the same applies to DirectX because I’ve seen something similar with DX11;
assuming the preprocessor code is shared)
The fix would be trivial (most likely a one liner), or is there another reason for this odd behavior?

Thank You

Martin

With which #version directive did you test that? (None means #version 110)

The GLSL specs for the #line directive changed and behave differently before #version 330 and after!

You’ll find the difference when comparing these two GLSL specs for the #line directive behavior.
Search these specs for “#line line” and read the paragraph below that. Mind the line+1 in the earlier version.
[url]https://www.khronos.org/registry/OpenGL/specs/gl/GLSLangSpec.1.50.pdf[/url]
[url]https://www.khronos.org/registry/OpenGL/specs/gl/GLSLangSpec.3.30.pdf[/url]

Thanks for the reply.
Indeed, changing to version 330 fixed the problem, I didn’t know about the difference in specs!
I thought GLSL had always followed the C preprocessor way but I was wrong. My apologies.