Add -Wdeprecated to show deprecated warnings#1072
Add -Wdeprecated to show deprecated warnings#1072quic-shaksuma wants to merge 1 commit intoqualcomm:mainfrom
Conversation
Add -Wdeprecated to show diagnostics for deprecated linker features and linker-script syntax. Assignment expressions having improper white-spaces around them should show a deprecated warning when -Wdeprecated is enabled. Update the documentation to include the assignment operator exception for MEMORY command. Fixes qualcomm#336 Signed-off-by: Shakti Suman <shaksuma@qti.qualcomm.com>
parth-07
left a comment
There was a problem hiding this comment.
Thank you for this patch. There are a few cases that does not work quite right with this change.
#!/usr/bin/env bash
cat >script.t <<\EOF
u =v;
PROVIDE(v =11);
EOF
ld.eld -m armelf -o a.out /dev/null -T script.t -Wdeprecated
ld.bfd -o a.bfd.out /dev/null -T script.tWe only want to warn/error when = does not have a space with the LHS symbol.
#!/usr/bin/env bash
cat >script.t <<\EOF
a = 0;
b = 11;
a += b; // +=
EOF
ld.eld -m armelf -o a.out /dev/null -T script.t -Wdeprecated
ld.bfd -o a.bfd.out /dev/null -T script.tThis incorrectly reports the warning:
Warning: script.t:3: missing whitespace around assignment operator '+=' in assignment expression is deprecated
>>> a += b; // +=
>>>
#!/usr/bin/env bash
cat >script.t <<\EOF
SECTIONS {
u=v : {
*(.text)
}
}
EOF
ld.eld -m armelf -o a.out /dev/null -T script.t -Wdeprecated
ld.bfd -o a.bfd.out /dev/null -T script.tThis linker script works fine with GNU ld and the current eld but fails with this patch.
If we are okay with not allowing = in symbol names and section names, then can you please take a look at this patch: #295. It parses the section and symbol names in LexState::Expr if they contain =. We can report the warning easily as well by checking if the op token is immediately after the LHS symbol token. This PR avoids many of the complication such as getOpWithoutSpace and splitting the token based on operators.
| return false; | ||
| } | ||
|
|
||
| bool ScriptParser::isValidAssignment(llvm::StringRef Op) { |
There was a problem hiding this comment.
Can we please rename the function to something like reportInvalidAssignment? The name isValidAssignment does not indicate that this function has a side affect and it also does not return false for invalid assignments as the name suggests it should.
Add diagnostics for assignment expression having improper white-spaces around the assignment operator.
Add -Wdeprecated to show the warnings of these kind.
Update the documentation to include the exception for MEMORY command.
Fixes #336