kastnermario / yaml-cpp

Automatically exported from code.google.com/p/yaml-cpp
MIT License
0 stars 0 forks source link

optimizing include guards and pragma once for GCC #91

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
The pragma once statements cause a lot of warnings in GCC before 3.4.
To avoid these please put the pragma once statements inside an #if.
To keep GCC's optimization for include guards, just move them to the top.

The solution for this looks like this:

#ifndef GUARD
#define GUARD
#if !defined(__GNUC__) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ 
>= 4)   // GCC supports "pragma once" correctly since 3.4
#pragma once
#endif

...

Original issue reported on code.google.com by matthias...@gmail.com on 12 Jan 2011 at 8:30

GoogleCodeExporter commented 8 years ago
Fixed (r438). Tiny change in sooooo many files :)

Original comment by jbe...@gmail.com on 2 Mar 2011 at 6:12