mirror of
https://github.com/cc65/cc65.git
synced 2024-06-08 15:29:37 +00:00
Add pragma once tests
This commit is contained in:
parent
167c31c148
commit
30ff2bdc6b
1
test/val/pragma-once-sample-link.h
Symbolic link
1
test/val/pragma-once-sample-link.h
Symbolic link
|
@ -0,0 +1 @@
|
|||
pragma-once-sample.h
|
21
test/val/pragma-once-sample.h
Normal file
21
test/val/pragma-once-sample.h
Normal file
|
@ -0,0 +1,21 @@
|
|||
/*
|
||||
** !!DESCRIPTION!! Simple #pragma once directive tests
|
||||
** !!ORIGIN!! cc65 regression tests
|
||||
** !!LICENCE!! Public Domain
|
||||
*/
|
||||
|
||||
#ifdef FILE_INCLUDED
|
||||
|
||||
#error "This file should not have been included twice"
|
||||
#define INCLUDED_TWICE
|
||||
|
||||
#else
|
||||
|
||||
#define FILE_INCLUDED
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/* a pragma once directive should work regardless of where it is located in
|
||||
the file, as long as it is seen by the preprocessor */
|
||||
#pragma once
|
27
test/val/pragma-once-test.c
Normal file
27
test/val/pragma-once-test.c
Normal file
|
@ -0,0 +1,27 @@
|
|||
/*
|
||||
** !!DESCRIPTION!! Simple #pragma once directive tests
|
||||
** !!ORIGIN!! cc65 regression tests
|
||||
** !!LICENCE!! Public Domain
|
||||
*/
|
||||
|
||||
|
||||
#include "pragma-once-sample.h"
|
||||
#include "pragma-once-sample.h"
|
||||
#include "pragma-once-sample-link.h"
|
||||
|
||||
/* pragma-once-sample-link.h is a symlink to pragma-once-sample. */
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
int main() {
|
||||
|
||||
#ifdef INCLUDED_TWICE
|
||||
printf("pragma-once-sample.h included more than once\n");
|
||||
return 1;
|
||||
#else
|
||||
printf("pragma-once-sample included once\n");
|
||||
return 0;
|
||||
#endif
|
||||
}
|
Loading…
Reference in New Issue
Block a user