<feed xmlns='http://www.w3.org/2005/Atom'>
<title>llvm-project.git/clang/test/CodeGenCXX/expr.cpp, branch main</title>
<subtitle>Unnamed repository; edit this file 'description' to name the repository.
</subtitle>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/'/>
<entry>
<title>[Clang] [NFC] Fix unintended `-Wreturn-type` warnings everywhere in the test suite (#123464)</title>
<updated>2025-01-18T18:16:33+00:00</updated>
<author>
<name>Sirraide</name>
<email>aeternalmail@gmail.com</email>
</author>
<published>2025-01-18T18:16:33+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=12f78e740c5419f7d1fbcf8f2106e7a40cd1d6f7'/>
<id>12f78e740c5419f7d1fbcf8f2106e7a40cd1d6f7</id>
<content type='text'>
In preparation of making `-Wreturn-type` default to an error (as there
is virtually no situation where you’d *want* to fall off the end of a
function that is supposed to return a value), this patch fixes tests
that have relied on this being only a warning, of which there seem 
to be 3 kinds:

1. Tests which for no apparent reason have a function that triggers the
warning.

I suspect that a lot of these were on accident (or from before the
warning was introduced), since a lot of people will open issues w/ their
problematic code in the `main` function (which is the one case where you
don’t need to return from a non-void function, after all...), which
someone will then copy, possibly into a namespace, possibly renaming it,
the end result of that being that you end up w/ something that
definitely is not `main` anymore, but which still is declared as
returning `int`, and which still has no return statement (another reason
why I think this might apply to a lot of these is because usually the
actual return type of such problematic functions is quite literally
`int`).
  
A lot of these are really old tests that don’t use `-verify`, which is
why no-one noticed or had to care about the extra warning that was
already being emitted by them until now.

2. Tests which test either `-Wreturn-type`, `[[noreturn]]`, or what
codegen and sanitisers do whenever you do fall off the end of a
function.

3. Tests where I struggle to figure out what is even being tested
(usually because they’re Objective-C tests, and I don’t know
Objective-C), whether falling off the end of a function matters in the
first place, and tests where actually spelling out an expression to
return would be rather cumbersome (e.g. matrix types currently don’t
support list initialisation, so I can’t write e.g. `return {}`).

For tests that fall into categories 2 and 3, I just added
`-Wno-error=return-type` to the `RUN` lines and called it a day. This
was especially necessary for the former since `-Wreturn-type` is an
analysis-based warning, meaning that it is currently impossible to test
for more than one occurrence of it in the same compilation if it
defaults to an error since the analysis pass is skipped for subsequent
functions as soon as an error is emitted.

I’ve also added `-Werror=return-type` to a few tests that I had already
updated as this patch was previously already making the warning an error
by default, but we’ve decided to split that into two patches instead.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
In preparation of making `-Wreturn-type` default to an error (as there
is virtually no situation where you’d *want* to fall off the end of a
function that is supposed to return a value), this patch fixes tests
that have relied on this being only a warning, of which there seem 
to be 3 kinds:

1. Tests which for no apparent reason have a function that triggers the
warning.

I suspect that a lot of these were on accident (or from before the
warning was introduced), since a lot of people will open issues w/ their
problematic code in the `main` function (which is the one case where you
don’t need to return from a non-void function, after all...), which
someone will then copy, possibly into a namespace, possibly renaming it,
the end result of that being that you end up w/ something that
definitely is not `main` anymore, but which still is declared as
returning `int`, and which still has no return statement (another reason
why I think this might apply to a lot of these is because usually the
actual return type of such problematic functions is quite literally
`int`).
  
A lot of these are really old tests that don’t use `-verify`, which is
why no-one noticed or had to care about the extra warning that was
already being emitted by them until now.

2. Tests which test either `-Wreturn-type`, `[[noreturn]]`, or what
codegen and sanitisers do whenever you do fall off the end of a
function.

3. Tests where I struggle to figure out what is even being tested
(usually because they’re Objective-C tests, and I don’t know
Objective-C), whether falling off the end of a function matters in the
first place, and tests where actually spelling out an expression to
return would be rather cumbersome (e.g. matrix types currently don’t
support list initialisation, so I can’t write e.g. `return {}`).

For tests that fall into categories 2 and 3, I just added
`-Wno-error=return-type` to the `RUN` lines and called it a day. This
was especially necessary for the former since `-Wreturn-type` is an
analysis-based warning, meaning that it is currently impossible to test
for more than one occurrence of it in the same compilation if it
defaults to an error since the analysis pass is skipped for subsequent
functions as soon as an error is emitted.

I’ve also added `-Werror=return-type` to a few tests that I had already
updated as this patch was previously already making the warning an error
by default, but we’ve decided to split that into two patches instead.</pre>
</div>
</content>
</entry>
<entry>
<title>Improve test coverage.</title>
<updated>2010-08-21T02:46:28+00:00</updated>
<author>
<name>Daniel Dunbar</name>
<email>daniel@zuster.org</email>
</author>
<published>2010-08-21T02:46:28+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=30eb5fa3ba0a3605db877c158a7d115d679147c2'/>
<id>30eb5fa3ba0a3605db877c158a7d115d679147c2</id>
<content type='text'>
llvm-svn: 111712
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
llvm-svn: 111712
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix PR7889 by generalizing some over specialized code.  There is no</title>
<updated>2010-08-18T00:08:27+00:00</updated>
<author>
<name>Chris Lattner</name>
<email>sabre@nondot.org</email>
</author>
<published>2010-08-18T00:08:27+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=b1995dffaf60784fd0546bf15ad0d464c480d4e7'/>
<id>b1995dffaf60784fd0546bf15ad0d464c480d4e7</id>
<content type='text'>
reason that this should be limited to simple lvalues.

llvm-svn: 111331
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
reason that this should be limited to simple lvalues.

llvm-svn: 111331
</pre>
</div>
</content>
</entry>
<entry>
<title>fix PR7892, a crash on valid in c++ codegen of __PRETTY_FUNCTION__</title>
<updated>2010-08-17T23:58:10+00:00</updated>
<author>
<name>Chris Lattner</name>
<email>sabre@nondot.org</email>
</author>
<published>2010-08-17T23:58:10+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=00d5141aefb2abd2fb3d308f3f4ca74b3b134a71'/>
<id>00d5141aefb2abd2fb3d308f3f4ca74b3b134a71</id>
<content type='text'>
llvm-svn: 111330
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
llvm-svn: 111330
</pre>
</div>
</content>
</entry>
<entry>
<title>implement codegen support for preinc as an lvalue, PR5514.</title>
<updated>2010-01-09T21:44:40+00:00</updated>
<author>
<name>Chris Lattner</name>
<email>sabre@nondot.org</email>
</author>
<published>2010-01-09T21:44:40+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=bb8976e36e73560f0556a53ebc3fa2ff4d2449f1'/>
<id>bb8976e36e73560f0556a53ebc3fa2ff4d2449f1</id>
<content type='text'>
llvm-svn: 93076
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
llvm-svn: 93076
</pre>
</div>
</content>
</entry>
<entry>
<title>Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'.</title>
<updated>2009-12-15T20:14:24+00:00</updated>
<author>
<name>Daniel Dunbar</name>
<email>daniel@zuster.org</email>
</author>
<published>2009-12-15T20:14:24+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=8fbe78f6fc7b41d1a4228c126fcb522131150518'/>
<id>8fbe78f6fc7b41d1a4228c126fcb522131150518</id>
<content type='text'>
 - This is designed to make it obvious that %clang_cc1 is a "test variable"
   which is substituted. It is '%clang_cc1' instead of '%clang -cc1' because it
   can be useful to redefine what gets run as 'clang -cc1' (for example, to set
   a default target).

llvm-svn: 91446
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
 - This is designed to make it obvious that %clang_cc1 is a "test variable"
   which is substituted. It is '%clang_cc1' instead of '%clang -cc1' because it
   can be useful to redefine what gets run as 'clang -cc1' (for example, to set
   a default target).

llvm-svn: 91446
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix PR5211: codegen shouldn't assume that the result of ||/&amp;&amp; is int </title>
<updated>2009-10-17T04:24:20+00:00</updated>
<author>
<name>Chris Lattner</name>
<email>sabre@nondot.org</email>
</author>
<published>2009-10-17T04:24:20+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=671fec8727926eebea88265905e54cb82fafecc7'/>
<id>671fec8727926eebea88265905e54cb82fafecc7</id>
<content type='text'>
anymore.  In C++ it is bool.

llvm-svn: 84308
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
anymore.  In C++ it is bool.

llvm-svn: 84308
</pre>
</div>
</content>
</entry>
<entry>
<title>Rename clang to clang-cc.</title>
<updated>2009-03-24T02:24:46+00:00</updated>
<author>
<name>Daniel Dunbar</name>
<email>daniel@zuster.org</email>
</author>
<published>2009-03-24T02:24:46+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=a45cf5b6b0790e829ad47cf946c149d8f1007324'/>
<id>a45cf5b6b0790e829ad47cf946c149d8f1007324</id>
<content type='text'>
Tests and drivers updated, still need to shuffle dirs.

llvm-svn: 67602
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Tests and drivers updated, still need to shuffle dirs.

llvm-svn: 67602
</pre>
</div>
</content>
</entry>
<entry>
<title>make ScalarExprEmitter::EmitCompare() emit the expression with the correct type instead of always zext it to an int</title>
<updated>2009-01-11T23:22:37+00:00</updated>
<author>
<name>Nuno Lopes</name>
<email>nunoplopes@sapo.pt</email>
</author>
<published>2009-01-11T23:22:37+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=a0abe62904c139aa5d6257bf70ec21c1980f541f'/>
<id>a0abe62904c139aa5d6257bf70ec21c1980f541f</id>
<content type='text'>
this fixes codegen of simple exprs in C++ like 'if (x != 0)'

llvm-svn: 62060
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
this fixes codegen of simple exprs in C++ like 'if (x != 0)'

llvm-svn: 62060
</pre>
</div>
</content>
</entry>
</feed>
