This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Always include defs.h first.


On 11/08/2012 03:49 AM, Yao Qi wrote:

>> diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c
>> index 05a030a..fbc2479 100644
>> --- a/gdb/arm-tdep.c
>> +++ b/gdb/arm-tdep.c
>> @@ -18,9 +18,10 @@
>>      You should have received a copy of the GNU General Public License
>>      along with this program.  If not, see<http://www.gnu.org/licenses/>.  */
>>
>> +#include "defs.h"
>> +
>>   #include <ctype.h>        /* XXX for isupper ().  */
>>
>> -#include "defs.h"
>>   #include "frame.h"
>>   #include "inferior.h"
>>   #include "gdbcmd.h"
> 
> What is the include order of "defs.h" and system headers, such as <ctype.h> and <stdio.h>?  When I learnt C programming some years ago, it was said system headers are included first, and then your own headers. This rule doesn't apply here?

defs.h includes config.h and config.h must always be included before system headers.

This is probably "authoritatively" described somewhere in autoconf's docs, but
I can't find it now.  But see e.g., <http://inaugust.com/post/68>.

-- 
Pedro Alves


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]