Skip to content

Commit

Permalink
Merge pull request #14 from h2o/kazuho/no-auto-include
Browse files Browse the repository at this point in the history
add preprocessor flag to disable automatic inclusion of qrintf.h and some standard headers
  • Loading branch information
kazuho committed May 9, 2015
2 parents b1c9a49 + 2c92cd3 commit b8ca552
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion bin/qrintf
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ $tempfn =~ s{\.c(.*)$}{.i@{[$1 ? 'i' : '']}}s
$tempfn = "$tempdir/$tempfn";

# invoke cpp
open(my $fh, "-|", $cc, '-E', (grep { $_ ne '-c' } @cflags), '-DQRINTF=1', '-include', "$pwd/../share/qrintf/qrintf.h", $fn)
open(my $fh, "-|", $cc, '-E', (grep { $_ ne '-c' } @cflags), '-DQRINTF=1', '-include', "$pwd/../include/qrintf.h", $fn)
or die "failed to invoke $cc -E:$!";
my $src = do { local $/; <$fh> };
close $fh
Expand Down
13 changes: 11 additions & 2 deletions share/qrintf/qrintf.h → include/qrintf.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,17 @@
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*/
#ifndef qrintf_h
#define qrintf_h
#if !defined(QRINTF_INCLUDE_COUNT)
# define QRINTF_INCLUDE_COUNT 1
#elif QRINTF_INCLUDE_COUNT==1
# undef QRINTF_INCLUDE_COUNT
# define QRINTF_INCLUDE_COUNT 2
#elif QRINTF_INCLUDE_COUNT==2
# undef QRINTF_INCLUDE_COUNT
# define QRINTF_INCLUDE_COUNT 3
#endif

#if (!defined(QRINTF_NO_AUTO_INCLUDE) && QRINTF_INCLUDE_COUNT==1) || (defined(QRINTF_NO_AUTO_INCLUDE) && QRINTF_INCLUDE_COUNT==2)

#ifdef __cplusplus
extern "C" {
Expand Down

0 comments on commit b8ca552

Please sign in to comment.