Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add preprocessor flag to disable automatic inclusion of qrintf.h and some standard headers #14

Merged
merged 2 commits into from
May 9, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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