Skip to content

deprecation messages leave extra lines in compiler output #187

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

Closed
Y-Less opened this issue Sep 28, 2017 · 3 comments
Closed

deprecation messages leave extra lines in compiler output #187

Y-Less opened this issue Sep 28, 2017 · 3 comments

Comments

@Y-Less
Copy link
Member

Y-Less commented Sep 28, 2017

I have this:

#pragma deprecated Use formatex instead
forward va_formatex(output[], size = sizeof(output), const fmat[], va_:STATIC_ARGS);

Which gives the following output when the function is used:

D:\work\SA-MP\gamemodes\deprecated.pwn(42) : warning 234: function is deprecated (symbol "va_formatex") Use formatex instead

D:\work\SA-MP\gamemodes\deprecated.pwn(53) : warning 234: function is deprecated (symbol "va_formatex") Use formatex instead

There are blank lines placed between the error lines. I've tried a few ways to get rid of them - changing line endings and escaping them, but neither work. With no message, the spacing is correct:

#pragma deprecated
forward va_formatex(output[], size = sizeof(output), const fmat[], va_:STATIC_ARGS);

Which gives the following output when the function is used:

D:\work\SA-MP\gamemodes\deprecated.pwn(42) : warning 234: function is deprecated (symbol "va_formatex")
D:\work\SA-MP\gamemodes\deprecated.pwn(53) : warning 234: function is deprecated (symbol "va_formatex")
@Dayvison
Copy link

same for #warning

@YashasSamaga
Copy link
Member

YashasSamaga commented Sep 29, 2017

After reading the warning/pragma deprecated directive, the compiler skips the leading white spaces. It then passes the remaining line string as it is to the error function. This line string would include a new line character which was added by the scripter.

However, the compiler adds also adds a new line by itself at the end of every warning and pragma deprecated. Therefore, the compiler would print two new lines.

The reason why the new line does not appear when an empty string is passed to #pragma deprecated is because the code which skips white spaces also skips new lines (ASCII 0xA).

while (*lptr<=' ' && *lptr!='\0')
            lptr++;

This issue exists with #error for the same reasons.

@Zeex
Copy link
Contributor

Zeex commented Oct 7, 2017

This was fixed by #192 and e7ecf38.

@Zeex Zeex closed this as completed Oct 7, 2017
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

No branches or pull requests

4 participants